View Single Post
Old 11-20-2005, 08:04 PM   #2 (permalink)
ez2c
Member
 
Join Date: Aug 2005
Location: Texas
Posts: 40
Default

Here's my 2cents on this:

You will need to decide whether you want the conditions connected with ORs or ANDs. You should probably use wildcard characters (%); otherwise, each LIKE in effect becomes a strict equality, and then only the OR version even makes sense.

Find rows where B contains any one (or two, or three) of the three strings:

select *
from A
where B like '%ccc%'
or B like '%ddd%'
or B like '%eee%'

Find rows where B contains all three strings, in any order:

select *
from A
where B like '%ccc%'
and B like '%ddd%'
and B like '%eee%'

Find rows where B contains all three strings, in the given order:

select *
from A
where B like '%ccc%ddd%eee%'

cheers
ez2c is offline   Reply With Quote
Sponsored Links