This is the sample data that I've got
id | program | Community ID | sdg |
---|---|---|---|
246 | #NoWasteGiving2020 | 97 | 11 |
246 | #NoWasteGiving2020 | 97 | 17 |
246 | #NoWasteGiving2020 | 97 | 10 |
With the data on the table above, how do I get the data to just be shown in one row and the sdg shown in one row. so at the end of the day the data will look like this:
246 #NoWasteGiving2020 97 10,11,17
This is the query that I've wrote
select Distinct a.id, a.title as program, b.community_id, c.goal_id as sdg
from programs_program as a
join associates_programcommunity as b on a.id = b.program_id
join associates_communitygoal as c on b.community_id = c.community_id