SELECT d.title, d.price
FROM dishes d
JOIN menu_has_dishes md ON d.id = md.dishid
JOIN menu m ON md.menu_id = m.id
WHERE m.restaurantid = [[your restaurant id goes here]]
Это даст вам что-то вроде этого:
-----------
|Fish|1.00|
|Ham |2.00|
|... |... |
-----------
Итак, давайте разберем части этого запроса:
--Tell the database what fields you care about
SELECT d.title, d.price
--Tell it what table to start with, and give it a nickname "d"
FROM dishes d
--join to menu_has_dishes so we know what menus contain each dish
JOIN menu_has_dishes md ON d.id = md.dishid
--join to menu so we know what restaurant has each menu
JOIN menu m ON md.menu_id = m.id
--finally, tell it what restaurant to look at
WHERE m.restaurantid = [[your restaurant id goes here]]