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 |
mruprai
Starting Member
12 Posts |
Posted - 2012-04-05 : 09:00:45
|
Hi i want to do a key word like from another table.There is a table tblkeyword with a keyword fieldi want to check the keywords in another fieldso something likeselect name from addresseswhere name like (select %keywords% from tblkeyword)any ideaS? |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-04-05 : 11:34:37
|
Do you mean something like this?SELECT nameFROM addresses a INNER JOIN tblKeyworkd b ON a.name LIKE '%'+b.keywords+'%' |
 |
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2012-04-05 : 11:35:48
|
[CODE]select a.namefrom addresses ainner join tblkeyword k on a.name like '%' + k.keywords + '%'[/CODE]You could also use CHARINDEX in the join condition[CODE] on CHARINDEX(k.keywords, a.name) <> 0[/CODE]One might be more performant but you'd need to test that out.=================================================There is a foolish corner in the brain of the wisest man. -Aristotle, philosopher (384-322 BCE) |
 |
|
|
|
|