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 the last 3 records of a field

Author  Topic 

krishnan_sn
Starting Member

14 Posts

Posted - 2003-12-16 : 06:59:07
hi,

assume that i am having a employee table. in that there is field call salary...the records look like this...
empno salary
1 3500
2 2500
3 5600
4 3800
5 5400
6 3000

in the above table i want to get the empno who are getting the minimum salary like ( last three records to be displayed)
empno salary
2 2500
6 3000
1 3500

how is it possible.....any one who knows it help me...

thanks

S.Navaneetha Krishnan

nr
SQLTeam MVY

12543 Posts

Posted - 2003-12-16 : 07:15:26
select top 3 * from tbl order by salary asc


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -