File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes SQL for lowest Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "SQL for lowest" Watch "SQL for lowest" New topic

SQL for lowest

James Hewitt

Joined: Jul 09, 2001
Posts: 27
I'm using JDBC to get values from a db2 database into a servlet. There is a column of integer values from which I want to retrieve the lowest value, but my sql isn't really up to it.
Is there an SQL statement which automatically returns the lowest value in a column?
rani bedi
Ranch Hand

Joined: Feb 06, 2001
Posts: 358
use the aggregate function MIN.
e.g. SELECT MIN(i) FROM tablename;

Cheers,<br />Rani<br />SCJP, SCWCD, SCBCD
wood burning stoves
subject: SQL for lowest