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 |
sqlberry
Starting Member
6 Posts |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2013-07-22 : 02:24:15
|
[code]select *from tbl t pivot ( max(Col1) for Col2 in ([A], [B]) ) p[/code] KH[spoiler]Time is always against us[/spoiler] |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-07-22 : 02:39:49
|
[code]SELECT MAX(CASE WHEN Col2 = 'A' THEN Col1 END) AS ColA,MAX(CASE WHEN Col2 = 'B' THEN Col1 END) AS ColB,Col3FROM tblGROUP BY Col3[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
sqlberry
Starting Member
6 Posts |
Posted - 2013-07-22 : 08:46:18
|
quote: Originally posted by visakh16
SELECT MAX(CASE WHEN Col2 = 'A' THEN Col1 END) AS ColA,MAX(CASE WHEN Col2 = 'B' THEN Col1 END) AS ColB,Col3FROM tblGROUP BY Col3 Thank you so much. God Bless you.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs
|
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-07-22 : 10:04:56
|
you're welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
sqlberry
Starting Member
6 Posts |
Posted - 2013-07-22 : 11:39:03
|
quote: Originally posted by visakh16 you're welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs
Will you help me in this one too?http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=186996 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-07-22 : 11:54:25
|
quote: Originally posted by sqlberry
quote: Originally posted by visakh16 you're welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs
Will you help me in this one too?http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=186996
Done------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|