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 |
hai
Yak Posting Veteran
84 Posts |
Posted - 2008-07-14 : 16:35:41
|
I have the following:ID x1 y1 y2 y3 y4 y51234 1 1 0 0 0 01234 1 0 1 0 0 01234 1 0 0 1 0 01234 1 0 0 0 1 01234 2 0 1 0 0 01234 2 0 0 1 0 01234 2 0 0 0 1 01234 2 0 0 0 0 11234 3 1 0 0 0 01234 3 0 1 0 0 01234 3 0 0 0 1 01234 4 1 0 0 0 01234 4 0 0 1 0 01234 4 0 0 0 1 01234 4 0 0 0 0 1I would like the result to return as below.ID x1 y1 y2 y3 y4 y51234 1 1 1 1 1 01234 2 0 1 1 1 11234 3 1 1 0 1 01234 4 1 0 1 1 1thanks |
|
jdaman
Constraint Violating Yak Guru
354 Posts |
Posted - 2008-07-14 : 16:55:37
|
select id, x1, max(y1), max(y2),...from YourTablegroup by id, x1 |
 |
|
|
|
|