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.

28th Feb 2019, 4:20 PM
Learner70
Learner70 - avatar
1 Answer
+ 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
28th Feb 2019, 4:50 PM
CalviŐ˛
CalviŐ˛ - avatar