Hi guys,
Not sure why I can't figure this one out. Basically, I have two tables with a many-to-many relationship so I have a junction table inbetween them.
For an example, consider the following database schema:
Restaurant (id, restaurant_name, suburb)
RestaurantCuisine (restaurant_id, cuisine_id)
Cuisine (id, cuisine_name)
So, many restaurants can have many cuisines.
The query I am trying to construct will return all the cuisines that exist in a suburb. A SQL example is as follows:
SELECT cuisine_name
FROM CuisineRestaurant
JOIN Cuisine ON Cuisine.id = CuisineRestaurant.cuisine_id
JOIN Restaurant ON Restaurant.id = CuisineRestaurant.restaurant_id
WHERE suburb LIKE '%x%';
This seems to make sense to me.
How do I do implement this using Zend_Db?