Good evening all, I have a table which contains like below :
Category ID
Cat1 1
Cat2 2
Cat1 3
Cat1 4
Cat1 5
Cat2 6
Cat2 7
I want to obtain a result like below
Cat1 1 - 1
Cat2 2
Cat1 3 - 5 (and not 3 - 4 - 5 (I need to select the Min & Max of the list)
Cat2 6
Cat2 7
I have began with the query
SELECT Category, LISTAGG(ID, ' ') WITHIN GROUP (ORDER BY Category) AS desc FROM table GROUP BY Category;
As you see, the Cat1 can contains 2 ID (Min & Max) but it is not the case for Cat2.
Have you an idea about this issue?
I hope to be clear.
thanks.
Cyril
cat1have multiple results (1-1 and 3-5)? - sgeddesCat2 6-7. - Gordon Linoff