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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Return the min ID

Author  Topic 

jung1975
Aged Yak Warrior

503 Posts

Posted - 2004-08-19 : 12:51:23
I have a table


ID A B
----------
1 1 1
2 1 2
3 1 5
4 1 5
5 1 5
6 1 7




I would like to return only the min ID with A and B
the result should looks like:


ID A B
1 1 1
2 1 2
3 1 5
6 1 7





Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2004-08-19 : 13:04:50
Select id = min(id), A, B from mytable group By A, B

Corey
Go to Top of Page
   

- Advertisement -