Monday, February 20, 2012

JOIN ON CONTAINS(Table1.Field1, Table2.Field2)

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!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

"HumanJHawkins" <JHawkins@.HumanitiesSoftware.Com> wrote in message
news:fihfc.9552$k05.6725@.newsread2.news.pas.earthl ink.net...
> 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!|||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!

"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:Qfigc.1635$kk5.16882717@.news-text.cableinet.net...
> 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
> "HumanJHawkins" <JHawkins@.HumanitiesSoftware.Com> wrote in message
> news:fihfc.9552$k05.6725@.newsread2.news.pas.earthl ink.net...
> > 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!|||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

"HumanJHawkins" <JHawkins@.HumanitiesSoftware.Com> wrote in message
news:fihfc.9552$k05.6725@.newsread2.news.pas.earthl ink.net...
> 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!|||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!

"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:Qfigc.1635$kk5.16882717@.news-text.cableinet.net...
> 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
> "HumanJHawkins" <JHawkins@.HumanitiesSoftware.Com> wrote in message
> news:fihfc.9552$k05.6725@.newsread2.news.pas.earthl ink.net...
> > 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!

No comments:

Post a Comment