Filter for unique records

  • Follow


i have a table with 
id  seq  group
1  AA    1
2  AB    1
3  AA    2
4  AB    2
5  ABC  3
6  BCA  3
7  ABC  4
8  BCA  4

now, i want to filter this data set so that, it comes with unique seq only 
like
1  AA    1
2  AB    1
5  ABC  3
6  BCA  3

but, remember, this is not what I want?? 

1  AA    1
4  AB    2
5  ABC  3
8  BCA  4

that means in the data set there are same seqs assigned to different Group, 
but i want all this similar seq to be in a single group and delete other 
groups with duplicated seq. i tried

SELECT grouping.seq, last(grouping.groupno)
FROM grouping group by grouping.seq;

which gave me the unique seq but with results what i did not wanted (above 
example)

Please, help me


0
Reply Utf 5/25/2007 11:48:00 PM

Hello. In the querie use the Totals option (it's the symbol of sum in excel) 
then in the column of Total row choose First.

I hope it helps.

Regards,
Marco






"ananta" wrote:

> i have a table with 
> id  seq  group
> 1  AA    1
> 2  AB    1
> 3  AA    2
> 4  AB    2
> 5  ABC  3
> 6  BCA  3
> 7  ABC  4
> 8  BCA  4
> 
> now, i want to filter this data set so that, it comes with unique seq only 
> like
> 1  AA    1
> 2  AB    1
> 5  ABC  3
> 6  BCA  3
> 
> but, remember, this is not what I want?? 
> 
> 1  AA    1
> 4  AB    2
> 5  ABC  3
> 8  BCA  4
> 
> that means in the data set there are same seqs assigned to different Group, 
> but i want all this similar seq to be in a single group and delete other 
> groups with duplicated seq. i tried
> 
> SELECT grouping.seq, last(grouping.groupno)
> FROM grouping group by grouping.seq;
> 
> which gave me the unique seq but with results what i did not wanted (above 
> example)
> 
> Please, help me
> 
> 
0
Reply Utf 5/26/2007 12:27:01 AM


1 Replies
209 Views

(page loaded in 0.062 seconds)

Similiar Articles:
















7/13/2012 9:44:27 PM


Reply: