Skip to content Skip to sidebar Skip to footer

How To Group Values Together If They Share The Same Id Value In Sql

I'm trying to group together authors who have worked on the same title. Currently i have the following query SELECT o.Output_Author_Name, a.Output_Title_Name FROM output_author_co

Solution 1:

You can do it using GROUP_CONCAT:

SELECT Output_Title_Name,GROUP_CONCAT(Output_Author_Name)
FROM output_author_country
GROUPBY Output_Title_Name

Solution 2:

this will work:

SELECTLISTAGG(output_author_name, ', ') WITHINGROUP (ORDERBY 
output_title_name),output_title_name 
FROM tablename;

Post a Comment for "How To Group Values Together If They Share The Same Id Value In Sql"