This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
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 Java Interview Guide this week in the Jobs Discussion 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
I agree. Here's the link:
subject: SQL for lowest
It's not a secret anymore!