0
Displaying multiple records corresponding to each distinct record from the same table.
Lets say i have a table name food. [Food_name] [place_name] [Noodles] [mybar1] [Burger] [McDonalds] [Noodles] [mybar2] I want to display distinct food_names along with place_names where it is served. Problem should be solved using MYSQL or PHP.
1 ответ
+ 2
SELECT food_name, GROUP_CONCAT(place_name SEPARATOR ',') 'Places'
FROM food
GROUP BY food_name;
Tested on https://www.db-fiddle.com/f/a5xPQ1Goc7KZHoykZ6cDGm/1