about Max value

Posted on 1998-04-25
Last Modified: 2010-04-16
how can i get Max value in set result that contains a table
of SQL?
  please answer me as soon as you could

Question by:mareakarlos
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 1219712
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.


Author Comment

ID: 1219713
thats was not the answer i want..
thanx any way


Expert Comment

ID: 1219714
Maybe you should explain what you want then.
Independent Software Vendors: 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!


Expert Comment

ID: 1219715
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?

Author Comment

ID: 1219716
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 .


Accepted Solution

evijay earned 0 total points
ID: 1219717
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


Author Comment

ID: 1219718
thats was a good answer
thank you


Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
java imports not found 4 47
collection output issue 9 59
web project error add remove 1 49
Website checklist for browser compatibility? 2 37
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question