Difference between revisions of "SQL - Group several lines in the same column with LIST TAG"

From GUILLARD WIKI
Jump to navigation Jump to search
Line 1: Line 1:
<syntaxhighlight lang="sql">
<syntaxhighlight lang="sql">
SELECT country,  
SELECT country,  
LISTAGG(first_name, ', ') WITHIN GROUP (order by first_name)  
listagg(first_name, ', ') WITHIN GROUP (order by first_name)  
FROM tablename  
FROM tablename  
GROUP BY country
GROUP BY country
</syntaxhighlight>
</syntaxhighlight>

Revision as of 16:45, 3 May 2018

SELECT country, 
listagg(first_name, ', ') WITHIN GROUP (order by first_name) 
FROM tablename 
GROUP BY country