Go Premium for a chance to win a PS4. Enter to Win

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • Last Modified:

about Max value

how can i get Max value in set result that contains a table
of SQL?
  please answer me as soon as you could

1 Solution
This isn't really a Java question, but I assume you're using JDBC. The standard SQL syntax is

select max(foo) from bar

to find the maximum value of the foo field in table bar. You'll get back a row with one element, the max value.

mareakarlosAuthor Commented:
thats was not the answer i want..
thanx any way

Maybe you should explain what you want then.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I belive he is reading a result set for display in, say a grid, and also needs the MAX value for one or more columns.

Is this the case?
mareakarlosAuthor Commented:
yes jpk ,,, yes indead.
thats what i'm looking for.
if u know how to do it.
write me the code for it
as soon as you can .

use the following tag with the max function in sql statement

select max(foo) "mymaxfoo"
from bar

Then, use the tagname mymaxfoo in the result set accessor functions in the same way as you use column name in simple sql expressions

Infact you can use the index based accessor functions getInt(0) where 0 is the index of the first column in the result set

mareakarlosAuthor Commented:
thats was a good answer
thank you


Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now