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.
| Author |
Topic |
|
Jas_The_Ace
Starting Member
15 Posts |
Posted - 2009-06-16 : 10:34:05
|
HelpI've got a list of productsProdID......Product-------------------1...........Mountain bike2...........road bus3...........Mountain Carthen I used term extraction to make a table of all the nouns:TermID.....Term----------------1..........mountain2..........bike3..........road4..........bus5..........carNow I want to index the two tables together to find out which term came from which product. Result will be like this:TermID......ProdID------------------1...........11...........32...........13...........24...........25...........3So what's wrong with this SQL?SELECT A.TermID, B.ProdIDFROM tblProduct BCROSS JOIN tblTerm AWHERE CONTAINS(B.Product, A.Term) ThanksJason |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-06-16 : 11:04:19
|
[code]select *from tblProduct p inner join tblTerm t on p.Product like '%' + t.Term + '%'[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-06-16 : 11:32:59
|
also:-select *from tblProduct p inner join tblTerm t on patindex('%' + t.Term + '%',p.Product) >0 |
 |
|
|
Jas_The_Ace
Starting Member
15 Posts |
Posted - 2009-06-16 : 17:50:44
|
| Thanks for your reply. I'm sure I'll use your ideas later.Sorry to be awkward but I wanted to use 'CONTAINS' predicate because it does Word breaking, stemming and thesaurus replacemsnts.When I run the SQL1 SELECT A.TermID, B.ProdID2 FROM tblProduct B3 CROSS JOIN tblTerm A4 WHERE CONTAINS(B.Product, A.Term)I get Error Line 4 Incorrect Sytax near 'A'I'm not sure if I'm allowed to use a field as the second parameter. All the examples I see use a variable.Does anyone have experience with this?ThanksJason |
 |
|
|
|
|
|