Groups | Blog | Home
all groups > sql server (alternate) > april 2004 >

sql server (alternate) : JOIN ON CONTAINS(Table1.Field1, Table2.Field2)


HumanJHawkins
4/14/2004 8:37:31 PM
Hi,

I am getting errors in the following... Is it even possible to join on
CONTAINS?

SELECT ListA.Content
FROM ListA LEFT OUTER JOIN ListB
ON CONTAINS(ListB.Content, ListA.Content)
WHERE ListB.Content IS NULL

Thanks!

John Bell
4/17/2004 10:32:16 PM
Hi

CONTAINS does not take a column as the second parameter, therefore you you
can't use it.

These may be an alternative:

SELECT A.Content
FROM ListA A LEFT OUTER JOIN ListB B
ON CHARINDEX( B.Content, A.Content ) > 0
WHERE B.Content IS NULL


SELECT A.Content
FROM ListA A LEFT OUTER JOIN ListB B
ON A.Content LIKE '%' + B.Content + '%'
WHERE B.Content IS NULL

John

[quoted text, click to view]

HumanJHawkins
4/19/2004 5:02:56 PM
I'm not sure if that would work. The reason I need to use CONTAINS (or an
equivalent) is that I need to do an inflectional search. I abbreviated the
code as much as possible for the group... Perhaps too much. What I really
need to join on is something like:

SELECT ListA.Content
FROM ListA LEFT OUTER JOIN ListB
ON CONTAINS(ListB.Content, FORMS OF(INFLECTIONAL, ListA.Content))
WHERE ListB.Content IS NULL

Any ideas?

Thanks!



[quoted text, click to view]

AddThis Social Bookmark Button