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 |
|
lah1308
Starting Member
3 Posts |
Posted - 2010-08-26 : 05:49:39
|
| My data is as below and I basically want to select the MIN sequence by user, and want the data returned in the second setUser Item Reason Status Sequence159695 C 2 8 3159703 A 1 7 1159703 B 3 5 2159703 C 2 8 3159725 C 2 8 3User Item Reason Status Sequence159695 C 2 8 3159703 A 1 7 1159725 C 2 8 3Any help would be appreciated |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-08-26 : 06:23:48
|
[code]select *from( select *, row_no = row_number() over (partition by User order by Sequence) from yourtable) dwhere d.row_no = 1[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|