Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Finding max value in column using java..

843859Jan 16 2007 — edited Mar 8 2008
Hello there!!

I have a problem that i tried finding in google but did not get what i wanted.. that's why i hope you guys could help me out.

How do i find the maximum value in a column using resultset..
for example..
Connection con = DriverManager.getConnection("jdbc:mysql:///eproc","root", "");//eproc is dbase name in MySQL
Statement stmt=con.createStatement();
ResultSet rs;
rs = stmt.executeQuery("SELECT MAX(id) FROM cat_work_sor_category");
now, how do i use resultset to make sure i get the max value and assign to integer variable...

Please do help me out.
Thankyou.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 5 2008
Added on Jan 16 2007
5 comments
1,319 views