Daily Shaarli

All links of one day in a single page.

November 27, 2023

sql - LISTAGG in Oracle to return distinct values - Stack Overflow

select col1, listagg(col2, ',') within group (order by col2)
from (
select col1,
col2,
row_number() over (partition by col1, col2 order by col1) as rn
from foo
order by col1,col2
)
where rn = 1
group by col1