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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Last Record 1

Status
Not open for further replies.

Gatorajc

MIS
Mar 1, 2002
423
US
Can only tell me how I would write a query similar to this one.

SELECT TOP 1 RecordNumber
FROM X
ORDER BY RecordNumber DESC


The query works with SQL Server but it does not seem to work with MySQL.

I want to get the very last record put into the database.

Thanks in advance.



AJ
[americanflag]


 
If you want the value generated for an auto_increment column on insert you should use

Code:
select last_insert_id()

If you want the highest value in a column

Code:
SELECT max(RecordNumber)
FROM X
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top