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 2005 Forums
 Transact-SQL (2005)
 Basic search query

Author  Topic 

dgburton1
Starting Member

20 Posts

Posted - 2008-08-06 : 20:25:22
Hi,

I have a table as follows:

Id ProductName
1 Bread Wholemeal Lrg Batch
2 Baked Beans Tin
3 Bread Wholemeal Large Batch
4 Bread Wholemel Large Batch


Would anyone be able to help me with a search-like query for the above table?

Basically I need to be able to pass in an Id and return bake, in order of relevance, the products that are the closest match.

For example, for Id=1 - 'Break Wholemeal Lrg Batch' the results would be:

3 (as Id=3 contains the words 'bread', 'wholemeal' and 'batch' from Id=1)
4 (as Id=4 contains the words 'bread' and 'batch' from Id=1)

Id=2 would not be returned as it shares none of the same words as Id=1.

All words are space-delimited.

Thanks in advance for your help! :)

VGuyz
Posting Yak Master

121 Posts

Posted - 2008-08-07 : 03:04:44
chk this link,

http://www.sommarskog.se/dyn-search.html
Go to Top of Page
   

- Advertisement -