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)
 How to get top 3 of distinct Employees

Author  Topic 

leoiser
Starting Member

20 Posts

Posted - 2007-07-04 : 04:44:28
I ve a table having below inforamtion

EmpID EmpName Timein LoginDate
***********************************
emp1 Ebin 1012 07/04/2007
emp1 Ebin 1130 07/04/2007
emp1 Ebin 1421 07/04/2007
emp1 Ebin 1800 07/04/2007
emp1 Ebin 2145 07/04/2007
QBM2 Raj 1212 07/04/2007
QBM2 Raj 1330 07/04/2007
QBM2 Raj 1521 07/04/2007
QBM2 Raj 1804 07/04/2007
QBM2 Raj 2025 07/04/2007
SSM2 John 0212 07/04/2007
SSM2 John 1030 07/04/2007
SSM2 John 1221 07/04/2007
SSM2 John 1904 07/04/2007
SSM2 John 2234 07/04/2007
RAH2 Ram 0812 07/04/2007

I want to get top 3 of all employees TimeIN

Result should be

EmpID EmpName Timein LoginDate
***********************************
emp1 Ebin 1012 07/04/2007
emp1 Ebin 1130 07/04/2007
emp1 Ebin 1421 07/04/2007
QBM2 Raj 1212 07/04/2007
QBM2 Raj 1330 07/04/2007
QBM2 Raj 1521 07/04/2007
SSM2 John 0212 07/04/2007
SSM2 John 1030 07/04/2007
SSM2 John 1221 07/04/2007
RAH2 Ram 0812 07/04/2007

How I will achieve this without using cursor?
please help.Thanks in advance

Kristen
Test

22859 Posts

Posted - 2007-07-04 : 05:05:35
See http://weblogs.sqlteam.com/mladenp/archive/2005/08/01/7421.aspx

2nd item

Kristen
Go to Top of Page
   

- Advertisement -