Author |
Topic |
Burzy
Starting Member
6 Posts |
Posted - 2012-06-28 : 02:21:07
|
Hello again!:)I have another problem. There is table:MyTable1ID, acc_numb, tar, stat1, 2, 50, 302, 5, 50, 301, 5, 50, 243, 2, 51, 901, 6, 51, 902, 2, 50, 892, 3, 30, 90I 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, stat1, 2, 50, 302, 5, 50, 242, 2, 50, 892, 3, 30, 903, 2, 51, 90I hope You understand what I mean. |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-06-28 : 02:28:44
|
select ID, acc_numb, tar, statfrom(selectrow_number() over (partition by tar,stat order by ID) as rnum,*from MyTable)dtwhere 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 - 2012-06-28 : 03:23:08
|
Big thanks for Your help, It's working! :) |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-06-28 : 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 MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|