Hi I’m wondering if it is possible to do something like below. Obviously I’ve tried to run this in phpMyAdmin but there is an error. Perhaps there is another way to write this query.
SELECT * FROM eat_eat_restaurants AS r
INNER JOIN eat_eat_cuisines AS c ON c.cuisine_id IN (r.cuisine_ids)
Further to this is it possible to select the restaurant name and cuisines in one row? e.g.
r_name c_names
Marco's Italian, Modern European
My 2 tables look like so:
TABLE EAT_EAT_RESTAURANTS
id r_name cuisine_ids
1 Marco's 1,2
2 Beldaro 3,4
3 Benny's 1,3
TABLE EAT_EAT_CUISINES
id c_name
1 Italian
2 Modern European
3 Greek
4 Belgian
5 ...
Your current schema is not normalized and very inefficient. Try 3 tables:
restaurants,cuisinesandrestaurant_cuisinesand do the query like this: