|
Simple way:
select * from tbl where (field1 like '{$value}%' or field2 like '{$value}%' or field3 like '{$value}%') and city like '{$city}%'
Correct way, assuming that a restaurant can be located in different cities and a city can contain multiple restaurants:
table "cities" with fields id, name, etc
table "category" with fields id, name, anything_else
table "business" with fields id, name, whatever_more
table "bcc" with fields business_id, city_id, category_id
select * from bcc join cities c on bcc.city_id = c.id join business b on bcc.business_id = b.id join category t on bcc.category_id = t.id where t.name = 'Restaurant' and city = 'Las Vegas'
Still in this aproach it is preferred to use numeric identificators instead of string values to increase performance.
|