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)
 How to perform FT query against many tables?

Author  Topic 

Tien
Starting Member

12 Posts

Posted - 2005-08-31 : 22:42:34
Hi,

I have following tables:

Customers
-------------
CustomerID int
CustomerName varchar(50)
...

Orders
-------------
OrderID int
Description varchar(50)
...

How can I perform a full-text query against both CustomerName and Description columns as same time? so I can retrieve search result like: CustomerID, CustomerName, OrderID, Description...

Thanks,
Tien,

Kristen
Test

22859 Posts

Posted - 2005-09-01 : 00:52:06
Would this do?

SELECT 'Customer' AS [Source], CustomerID AS [ID], CustomerName AS [Description]
FROM Customers
WHERE CustomerName LIKE '%FRED%'
UNION ALL
SELECT 'Orders' AS [Source], OrderID, Description
FROM Orders
WHERE Description LIKE '%FRED%'
ORDER BY [Source], [ID]

Kristen
Go to Top of Page

Tien
Starting Member

12 Posts

Posted - 2005-09-02 : 22:12:00
Thanks but I want to search with full-text query, not with LIKE keyword :)
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-09-03 : 01:47:07
Could you use the same idea with a Union, and the CONTAINS syntax for a Full Text query?

Kristen
Go to Top of Page

Tien
Starting Member

12 Posts

Posted - 2005-09-06 : 22:20:39
I can :), thanks
Go to Top of Page
   

- Advertisement -