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 |
|
chetanb3
Yak Posting Veteran
52 Posts |
Posted - 2012-04-26 : 08:57:16
|
| My current result set is like belwo c1 c2 c3 c4------------------------------- A NULL NULL NULL NULL B NULL NULL NULL NULL C NULL NULL NULL NULL DI wand to combine rows in to single row like below please help..c1 c2 c3 c4------------------------------- A B C D |
|
|
singularity
Posting Yak Master
153 Posts |
Posted - 2012-04-26 : 09:01:51
|
| [code]select max(c1) as c1, max(c2) as c2, max(c3) as c3, max(c4) as c4from yourtable[/code] |
 |
|
|
chetanb3
Yak Posting Veteran
52 Posts |
Posted - 2012-04-26 : 09:14:03
|
quote: Originally posted by singularity
select max(c1) as c1, max(c2) as c2, max(c3) as c3, max(c4) as c4from yourtable
thanks.. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2012-04-26 : 09:17:30
|
| What do you want to return if your current result set is like belowc1 c2 c3 c4------------------------------- A NULL NULL NULL NULL B NULL NULL NULL NULL C NULL NULL NULL NULL DK NULL NULL NULL NULL L NULL NULL NULL NULL A NULL NULL NULL NULL PMadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-04-26 : 10:53:25
|
quote: Originally posted by chetanb3
quote: Originally posted by singularity
select max(c1) as c1, max(c2) as c2, max(c3) as c3, max(c4) as c4from yourtable
thanks..
doesnt make any sense to me to merge data like this unless you've another related field based on which you do the merge------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|