File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Search for last record and display contents

 
Annemarie McKeown
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you search for the last record entered in your table. What query would I use to do this?
Many thanks.
 
James Swan
Ranch Hand
Posts: 403
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have a table with a nice auto-incrementing primary key column defined as an integer etc, you could issue:
select * from mytable
where myprimarykey = (select max(myprimarykey) from mytable)
 
Annemarie McKeown
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks James, worked out fine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic