Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LIKE Query

Status
Not open for further replies.

droppedeye

Programmer
Jan 9, 2007
6
0
0
US
Is it possible to use a LIKE with an IN statement? The following example might make this more clear.

SELECT stuff from joined tables
WHERE searchTerm IN (SELECT allkeywords)

What I want to want to have happen is if the keywords returned by the inner query is "barely" and the searchTerm is "are" I want it to be a match. As far as my understanding goes the IN statement is looking for complete matches. Any help would be greatly appreciated! Thanks.
 
Say your inner query is:
SELECT keyword FROM tblKeywords

then:
SELECT stuff
FROM joined tables
INNER JOIN tblKeywords ON keyword Like '%' || searchTerm || '%'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top