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
 how to get last record of a table

Author  Topic 

miraskariali
Starting Member

1 Post

Posted - 2005-11-04 : 10:15:45
Hi,

1Q How to get the last record of a table in SQL SERVER 2000.

2Q How to get the 2/3/4 maximum salary with the same query by just changing the number.

X002548
Not Just a Number

15586 Posts

Posted - 2005-11-04 : 10:18:23
A1: The order of data in a database has no menaing. You need to supply an ORDER
SELECT TOP 1 * FROM myTable99 ORDER BY <something> DESC

A2: Probably the homework question is looking for dynamic SQL



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-11-04 : 10:32:30
2.
http://weblogs.sqlteam.com/mladenp/archive/2005/08/01/7421.aspx
point 9

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -