Click to See Complete Forum and Search --> : SQL Question


ttohme
July 29th, 2003, 07:41 PM
Hi guys,

is there a query that I can use to compare 2 strings where one string is contained in another.

ex: String1 in DB = "John is good"
String2 in Query = "John is"

So I would like to query the DB for any rows that contains John is and which returns John is good.


Thanks

saktya
July 29th, 2003, 08:24 PM
May be U should use "Like" in u'r query.

select *
from [table]
where [column name] Like 'john is%' ;

I hope it can help ;)

Pinky98
July 31st, 2003, 08:49 AM
yes, you need the LIKE keyword. Then use the wild cards in the string. These wild cards characters can be set but generally they are % and _ where % means any number of characters and _ is a single unknown character.