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
 General SQL Server Forums
 New to SQL Server Programming
 Get First Record from Group By Query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-05-30 : 09:28:14
Hendra writes "I'd like to know is there any way or any statement that can help me to get first or last record from the group by query ?
I'm using sql Server 2000
Thank's

_Hendra_"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-30 : 09:55:54

First
Select Top 1 ... from table group by cols Order by keycol ASC

Last
Select Top 1 ... from table group by cols Order by keycol DESC


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -