The easiest thing to do would be to load up a temp table, and then join to it:
CREATE TABLE #tmp (SearchTerm varchar(1000))
INSERT INTO #tmp (SearchTerm) VALUES ('Canton')
INSERT INTO #tmp (SearchTerm) VALUES ('Ohio')
INSERT INTO #tmp (SearchTerm) VALUES ('Biology')
INSERT INTO #tmp (SearchTerm) VALUES ('Chemistry')
SELECT *
FROM tbl_test t1 INNER JOIN
#tmp t2 ON t1.fld_search LIKE '%' + t2.SearchTerm + '%'
DROP TABLE #tmp
That can be put into an sproc, to make it easier to run from PHP...
Main Topics
Browse All Topics





by: rrjegan17Posted on 2009-03-31 at 08:04:48ID: 24029663
You should use IN operator for this
select * from tbl_test where fld_search IN ('Canton', 'Ohio', 'Biology' , 'Chemistry')
Hope this helps