| Author |
Topic  |
|
|
Burzy
Starting Member
6 Posts |
Posted - 06/28/2012 : 02:21:07
|
Hello again!:)
I have another problem. There is table:
MyTable1
ID, acc_numb, tar, stat 1, 2, 50, 30 2, 5, 50, 30 1, 5, 50, 24 3, 2, 51, 90 1, 6, 51, 90 2, 2, 50, 89 2, 3, 30, 90
I want to get result, where ('tar' and "stat') shows only one time and (ID and acc_number) shows just as info.
For example:
ID, acc_numb, tar, stat 1, 2, 50, 30 2, 5, 50, 24 2, 2, 50, 89 2, 3, 30, 90 3, 2, 51, 90
I hope You understand what I mean. |
|
|
webfred
Flowing Fount of Yak Knowledge
Germany
8515 Posts |
Posted - 06/28/2012 : 02:28:44
|
select ID, acc_numb, tar, stat from ( select row_number() over (partition by tar,stat order by ID) as rnum,* from MyTable )dt where rnum = 1
No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Burzy
Starting Member
6 Posts |
Posted - 06/28/2012 : 03:23:08
|
| Big thanks for Your help, It's working! :) |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47189 Posts |
Posted - 06/28/2012 : 16:21:07
|
so you're not concerned on which values of ID, acc_numb have to be shown for a particular tar,stat group?
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
| |
Topic  |
|
|
|