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

Grabbing the most recent row out of a table

Status
Not open for further replies.

jalbao

Programmer
Nov 27, 2000
413
US
hey sqlmongers -
I run an insert query. the insert query adds one row of data. i want to run another query that grabs the id of the row that was previously added. now i need to make sure that the id that i grab is not going to grab an id that was actually added by another user. what sql statement would be best for this situation?

thanks in advance
 
First, you need to have a known unique identifier for the record. The rest, as they say, is a piece of cake. Just do the query with the where clause for the known unique identifier. A way to do this is sort of detailed in faq700-184 - at least the part about generating the known unique identifier. Obviously, you would need to add a field to you table for this identifier, but the rest really is quite simple.


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top