aspose file tools*
The moose likes JDBC and the fly likes  how to get last inserted row in MySql through JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark " how to get last inserted row in MySql through JSP" Watch " how to get last inserted row in MySql through JSP" New topic
Author

how to get last inserted row in MySql through JSP

Chintan Shah
Greenhorn

Joined: Jun 29, 2005
Posts: 27
Hi,
I am trying to get the last inserted row in MySql..but not able to fetch it.
this is what i used
i have one column order_id which is auto_increment
SELECT * FROM tablename WHERE order_id=(SELECT MAX(order_id) FROM tablename)
any help is appreciated .
the usage of lastinsert() method is also not successful
chintan
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

Moved to the JDBC forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to get last inserted row in MySql through JSP
 
Similar Threads
Know auto incremented pimary key
Queries not committing in transaction
how to find all tablename and rowcount of each table from database?
SQL Server limiting result set
how to know the last auto-increment number using JDBC