Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL for lowest

 
James Hewitt
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
Thanks,
James
 
rani bedi
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use the aggregate function MIN.
e.g. SELECT MIN(i) FROM tablename;
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic