Skip to content

Instantly share code, notes, and snippets.

@rustam-swe
Last active September 22, 2021 06:42
Show Gist options
  • Save rustam-swe/c7529d02b634ecb1989e6f93aad39901 to your computer and use it in GitHub Desktop.
Save rustam-swe/c7529d02b634ecb1989e6f93aad39901 to your computer and use it in GitHub Desktop.
Concat cells (rows) of one column by another column
# column_name - column name filter by
# column_name_2 - column name to concat
# table_name - table name :)
SELECT column_name,
GROUP_CONCAT(DISTINCT column_name_2 SEPARATOR ',')
FROM table_name
GROUP BY column_name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment