I have a single table in which I'm trying to run an SQL query (Classic ASP). The table is structured like so:
ID Name City State Zip Country
1 Name1 Los Angeles CA 90210 USA
2 Miami New York NY 10011 USA
3 Name3 Miami FL 33184 USA
I'd like to be able to run a query that searched multiple columns (e.g. "Miami, FL) and returns the proper results.
The search comes in as Name=SearchTerm
, and my current SQL query is:
fp_sQry="SELECT * FROM tableName WHERE ((Shiur = '2') or (Shiur IS NULL)) AND ((City LIKE '::Name::%') or (State LIKE '%::Name::') or (Name LIKE '%::Name::%') or (Zip LIKE '%::Name::%') or (Country LIKE '%::Name::%')) AND (Nusach LIKE '%::Nusach::%') ORDER BY Name ASC"
As it stands, I am only able to run a search for a single column, so Name=Miami
actually searches all columns and returns all the proper results, whereas Name=Miami
,+FL or Name=Miami+FL
returns 0 results.
Any ideas on how to tweak my query to match for multiple parts of the query in several columns?