Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 output in one record set

Author  Topic 

dass05555
Yak Posting Veteran

55 Posts

Posted - 2008-05-21 : 12:29:52
dear gurus...,

my record output as like below..,

P.no Product complaint1 comp_date1 complaint2 comp_date2
1 pen bad design 05/08/2008 null null
1 pen null null bad quality 05/18/2008
2 toy bad design 05/07/2008 null null
2 toy null null bad quality 05/19/2008

but i need ouput as follows

P.no Product complaint1 comp_date1 complaint2 comp_date2
1 pen bad design 05/08/2008 bad quality 05/18/2008
2 toy bad design 05/07/2008 bad quality 05/19/2008

kindly do the needful...,
Thanks in advance...

cool...,

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-21 : 12:40:31
[code]SELECT Pno,Product,
MAX(complaint1) AS complaint1,
MAX(comp_date1) AS comp_date1,
MAX(complaint2) AS complaint2,
MAX(comp_date2) AS comp_date2
FROM Table
GROUP BY Pno,Product
[/code]
Go to Top of Page
   

- Advertisement -