I have a web page that displays a list of events. By default all events are being displayed. The user can use an input field to filter that list. He can either enter a city_code, a city_name or a city_state. Here below my DB tables and their content:
Locations
city_code (pk)
city_name
city_state
Events
event_id (pk)
event_name
city_code(foreign key)
My idea to achieve what I want is:
1/ Filter the locations table based on the input value:
(SELECT * FROM locations WHERE city_code LIKE input OR city_name LIKE input or city_state LIKE input).
2/ Make a JOIN query between the events table and the filtered locations table.
My problem is that I know how to filter a table, I know how to make a join query, but not how to make both "together". I hope someone can help. Thank you in advance for your replies. Cheers. Marc.