Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Joining two tables that both use CONTAINSTABLE...

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-04-08 : 11:47:33
Jason writes "Good day,

I'm needing to join two tables that both use the CONTAINSTABLE predicate, but am having problems coming up with a solution that provides results for both tables without grabbing extraneous results as well.

This is the first SQL statment:
SELECT TOP 150 L.Rank, SFAQ.FAQID, SFAQ.Title
FROM CONTAINSTABLE(tblSearchFAQ, *, 'ISABOUT ("-dsa*")') L INNER JOIN tb_SearchFAQ SFAQ ON SFAQ.FAQID = L.[Key] WHERE SFAQ.FK_LangID = 1 ORDER BY L.Rank DESC

This is the second SQL statment:
SELECT TOP 150 K.Rank, SFAQ.FAQID, SFAQ.Title FROM CONTAINSTABLE(tblSearchFAQDetails, *, 'ISABOUT ("-dsa*")')
K INNER JOIN tb_SearchFAQDetails SFAQD ON SFAQD.DetailsID = K.[Key] INNER JOIN tb_SearchFAQ SFAQ ON SFAQ.FAQID = SFAQD.FK_FAQID WHERE SFAQ.FK_LangID = 1 ORDER BY K.Rank DESC


I've got them somewhat together at this point, but I'm getting the results from the "SFAQ.FK_LangID = (other numbers as well)" part of the SQL statement.

Here's the two statements combined at this point:
SELECT TOP 150 K.Rank, L.Rank, SFAQ.FAQID, SFAQ.Title
FROM CONTAINSTABLE(tblSearchFAQDetails, *,
'ISABOUT ("work*")') K FULL OUTER JOIN
CONTAINSTABLE(tblSearchFAQ, *, 'ISABOUT ("work*")') L ON
K.[Key] = L.[Key] FULL OUTER JOIN
tblSearchFAQDetails SFAQD ON
K.[Key] = SFAQD.DetailsID FULL OUTER JOIN
tblSearchFAQ SFAQ ON L.[Key] = SFAQ.FAQID
WHERE (SFAQ.FK_LangID = 1)
ORDER BY K.RANK DESC, L.RANK DESC

Any ideas?

TiA,
Jason"
   

- Advertisement -