20 Mar 2011
select x.col1,x.col2,max(x.newcol3),max(x.newcol4) from
(
select col1,col2,col3,case row_number() over(partition by col1,col2 order by col3 desc) when 1 then col3 else null end newcol3,
case row_number() over(partition by col1,col2 order by col3 desc) when 2 then col3 else null end as newcol4
from u1.t1)x group by x.col1,x.col2;
You must sign in to leave a comment.
I have data in Apps Table as:
(app_id,store_id,mail_id)
(1,111,'abc.com')
(1,111,'def.com')
(2,222,'krk.com')
(2,222,'gfh.com')
How could I obtain the output in this format:
(app_id,store_id,mail_id)
(1,111,'abc.com,def.com')
(2,222,'krk.com,gfh.com')