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 |
goodman2253
Yak Posting Veteran
88 Posts |
Posted - 2014-11-03 : 07:59:19
|
Hello How are you guys, Once again I stuck with a problem and need help from you guys. The Source Data is ID--VAL1--VAL2--VAL3--VAL4--VAL5--VAL61---151---- ----- ----- Y----- ----- 2---151---- -----Y----- -----Y-----Y3---152----Y----- ------ ----- ------4---152---- -----Y------ ----Y------The Expected Output should beID--VAL1--VAL2--VAL3--VAL4--VAL5--VAL61--151----- ----Y------Y-----Y-----Y2--152-----Y-----Y------ -----Y----- Thanks |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2014-11-03 : 08:40:47
|
[code]select dense_rank() over (order by val1) as ID, val1, max(val2) as VAL2, max(val3) as VAL4, max(val4) as VAL4, max(val5) as VAL5, max(val6) as VAL6from YourTablegroup by val1;[/code] |
|
|
|
|
|