Let's suppose I have this table:
1|A|B|10
2|A|B|20
3|B|C|20
How to write a query to get this value:
1|A|B|10,20
3|B|C|20
Let's suppose I have this table:
1|A|B|10
2|A|B|20
3|B|C|20
How to write a query to get this value:
1|A|B|10,20
3|B|C|20
Something like this should work:
SELECT MIN(column_1) AS min_value
, column_2
, column_3
, STRING_AGG(column_4 ORDER BY column_4, ' ')
FROM table_name
GROUP BY column_2, column_3
ORDER BY MIN(column_1);