Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying last record

Status
Not open for further replies.

Rya

Technical User
Jan 14, 2003
2
NZ
Hi this is a simple one, but I was just wandering if someone could help me to write an sql string that returns the last record. Similar too:
SELECT TOP 1 * FROM dbo.Question
But selecting the Bottom one.

Or maybe better returning the number of records rather than the last record.
 
To return the number of records
use a select count(idfield) in your query

Transcend
[gorgeous]
 
"last record" based on what? if the table has an IDENTITY column, it's easy

select top 1 *
from dbo.Question
order by IDfield descending


rudy
 
well, what do you mean by last record? the record which is just inserted or updated? or the last record by physical storage? ô¿ô Kishore
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top