943,945 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Unsolved
  • Views: 1077
  • MySQL RSS
Oct 2nd, 2009
0

retrieve the last record???

Expand Post »
How to write a query to retrieve the last record that is entered. ???
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster
jrosh is offline Offline
140 posts
since Sep 2009
Oct 2nd, 2009
1

Re: retrieve the last record???

I do not know if this can help you, but if you have a date field which you can order by desc, then you can use Top 1 something like this.

sql Syntax (Toggle Plain Text)
  1. SELECT top 1 Field1
  2. FROM table1
  3. ORDER BY datefield desc

if you dont have a date maybe have a index field that is the easiest way to do that.
regards
Reputation Points: 56
Solved Threads: 56
Posting Pro in Training
jbisono is offline Offline
433 posts
since May 2009
Oct 5th, 2009
-2

Re: retrieve the last record???

no u just have an id column that auto increments then ur like mysql_query("SELECT MAX(id) FROM table or something
Reputation Points: 15
Solved Threads: 7
Posting Pro in Training
SKANK!!!!! is offline Offline
428 posts
since Apr 2009
Oct 5th, 2009
0
Re: retrieve the last record???
if you have an auto increment field, just use mysql_insert_id() to get the last auto increment
Reputation Points: 26
Solved Threads: 12
Junior Poster in Training
kylegetson is offline Offline
89 posts
since Sep 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: help with searching in mysql
Next Thread in MySQL Forum Timeline: how to record 3-digit zeros





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC