Click to See Complete Forum and Search --> : Need some help in searching


Yovav
May 8th, 2004, 03:27 PM
Dear Gurus.

How can I find records that contain a STRING from some (more than one) other fields ?

for example, I have:

Name_First = "aaa"
Name_Middle = "bbb"
Name_Last = "ccc"

Key_Words = "aaa,bbb,ccc"
(includes all values - comma separated)

How can I do the SELECT so that when I search for "bbb" on Key_Words I will get my record ?

Should I use "LIKE %aaa%" or something like this ?
(should I keep the comma separators ?)


Thanks in advance, Yovav.

hspc
May 9th, 2004, 02:55 AM
Select * from table1 where Key_Words like ('%' + Name_First + '%') or
Key_Words like ('%' + Name_Middle + '%') or
Key_Words like ('%' + Name_Last + '%')