Issue
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.
Solution
SELECT MIN(id), show_id, show_name, season_id, GROUP_CONCAT(day)
FROM table
GROUP BY 2,3,4
Answered By – Akina
Answer Checked By – Candace Johnson (BugsFixing Volunteer)