I have two columns in a table.One represents work and the other represents date on which that needs to perform..I need the output as a minimum possible combination. For the below records I am expecting the output as W1,W2,W3 on 16th and 17th . And W4,W5 on 20th. Is there anyway to achieve this in a query?
W1 15-06-2015
W1 16-06-2015
W1 17-06-2015
W2 16-06-2015
W2 17-06-2015
W2 18-06-2015
W3 16-06-2015
W3 17-06-2015
W4 20-06-2015
W4 21-06-2015
W5 20-06-2015
In Oracle 11g use function
listagg()
twice:SQLFiddle demo
... or if you are interested only in combinations containing more than one common value: