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.
Author |
Topic |
raaj
Posting Yak Master
129 Posts |
Posted - 2011-09-02 : 01:49:08
|
Hi Guys,I have written a query and sample output is something similar to the below :User col1 col2 col2ABC 100 NULL NULLABC NULL 200 NULLABC NULL NULL 300Now i want to write a query where the output should look like :User Col1 Col2 Col3ABC 100 200 300 Any suggestions please..... |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-02 : 01:58:04
|
[code]SELECT User,MAX(col1) AS col1,MAX(col2) AS col2,MAX(col3) AS col3FROM Table GROUP BY user[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
raaj
Posting Yak Master
129 Posts |
Posted - 2011-09-04 : 20:01:57
|
Thanks visakh....that worked perfectly........ |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-04 : 21:36:55
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|