I have this table:
I want to get results something like this:
If you note,
- I require the id of the first record which matches the condition. For example, ID 6 & 8 are the first record of SH001 - S2 & SH002 - S1, respectively.
- Plus values in 'day' should be of proper sequence as shown & not like 'Fri,Mon,Thu'.
I tried some queries but it was not giving me the intended results. So can anyone help me in the same.
CodePudding user response:
SELECT MIN(id), show_id, show_name, season_id, GROUP_CONCAT(day)
FROM table
GROUP BY 2,3,4
CodePudding user response:
SELECT id, show_id, show_name, session_id, GROUP_CONCAT(day) FROM table
GROUP BY show_id, show_name, session_id;