sql server - Unable to combine the rows in sql by group by clause -


i want combine 3 rows single row in sql server 2005, have tried group clause, not combine 3 rows single row

below code, have written

 select *  ( select     case     when  postatus = 'y' ,  approverid = '1111'     convert(varchar(10),  trasdate ,103)     end [col1],    case    when  postatus = 'y' ,  approverid = '401'    convert(varchar(10),  trasdate ,103)    end [col2],    case    when  postatus = 'y' , ( approverid = '329' or  approverid = '1495' or  approverid = '1239')    convert(varchar(10),  trasdate ,103)    end [col3] tblpo_approvalstatus prnumber = '000002' ) t group col1,col2,col3 

i got result

 col1      col2       col3 9/6/2015  null       null null      9/8/2015   null null      null       9/15/2015 

i want them single row

 col1       col2         col3 9/6/2015   9/8/2015     9/15/2015  

thanks in advance

did try this?

select no, max([po date]), max([pr date]), max([qar date]) t group no; 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -