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
 Transact-SQL (2000)
 Joins

Author  Topic 

Jim.J
Starting Member

5 Posts

Posted - 2002-09-06 : 08:01:38
Hi all,

I need to do a whole load of joins which is fine, but i cant figure it out when i add a freetexttable from my full-text index.

So far i have the freetexttable:

-- Execute the SELECT statement.
EXECUTE ( 'SELECT '
+' FT_TBL.Vacancy_Title, '
+ ' FT_TBL.Vacancy_Description, '
+ ' KEY_TBL.RANK '
+' FROM tblVacancy AS FT_TBL INNER JOIN '
+ ' FREETEXTTABLE(tblVacancy, Vacancy_Title, '
+ ' "test") AS KEY_TBL '
+ ' ON FT_TBL.Vacancy_ID = KEY_TBL.[KEY]'

Thats fine. But now i need to join various category and location tables that are related. This is my join before i realised i wanted to add the freetexttable.

SELECT tblVacancy.*, tblLocation.*, tblType.*, tblCategory.*, tblAgency.*
FROM tblAgency INNER JOIN (tblLocation INNER JOIN (tblType INNER JOIN (tblCategory INNER JOIN tblVacancy ON tblCategory.Category_ID = tblVacancy.Vacancy_CatID) ON tblType.Type_ID = tbl_Vacancy.Vacancy_TypeID) ON tblLocation.Location_ID = tblVacancy.Vacancy_LocationID) ON tblAgency.Agency_ID = tblVacancy.Vacancy_AgencyID

So basically i need to combine both parts above, can anyone help!

Thanks,
Jim.




Edited by - Jim.J on 09/06/2002 08:07:16

r937
Posting Yak Master

112 Posts

Posted - 2002-09-06 : 08:52:06
SELECT FT_TBL.*
, tblLocation.*
, tblType.*
, tblCategory.*
, tblAgency.*
, FT_TBL.Vacancy_Title
, FT_TBL.Vacancy_Description
, KEY_TBL.RANK

FROM tblAgency
INNER JOIN (tblLocation
INNER JOIN (tblType
INNER JOIN (tblCategory
INNER JOIN (tblVacancy AS FT_TBL
INNER JOIN FREETEXTTABLE(tblVacancy
, Vacancy_Title, "test") AS KEY_TBL
ON FT_TBL.Vacancy_ID
= KEY_TBL.[KEY])

ON tblCategory.Category_ID
= FT_TBL.Vacancy_CatID)
ON tblType.Type_ID
= FT_TBL.Vacancy_TypeID)
ON tblLocation.Location_ID
= FT_TBL.Vacancy_LocationID)
ON tblAgency.Agency_ID
= FT_TBL.Vacancy_AgencyID


disclaimer: i've never worked with fulltext search

all i did was combine your queries according to basic rules of sql

aliasing the Vacancy table in the freetext join requires changing the table qualifier wherever it's used

rudy
http://rudy.ca/
Go to Top of Page

Jim.J
Starting Member

5 Posts

Posted - 2002-09-06 : 09:25:44
Thanks you.

Go to Top of Page
   

- Advertisement -