Solved

about Max value

Posted on 1998-04-25
7
171 Views
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

thanx
0
Comment
Question by:mareakarlos
7 Comments
 
LVL 2

Expert Comment

by:jaked
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.

0
 

Author Comment

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

0
 
LVL 2

Expert Comment

by:jaked
ID: 1219714
Maybe you should explain what you want then.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 6

Expert Comment

by:jpk041897
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?
0
 

Author Comment

by:mareakarlos
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 .


0
 
LVL 4

Accepted Solution

by:
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


0
 

Author Comment

by:mareakarlos
ID: 1219718
thats was a good answer
thank you

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

839 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