To find Maximum
This is a discussion on To find Maximum within the DB2 forums, part of the Database category; I want to find the maximum value in a column in db2. How can I do this?...
-
To find Maximum
I want to find the maximum value in a column in db2. How can I do this?
-
12-21-2006, 06:50 AM #2
- Join Date
- Aug 2006
- Answers
- 5
The following query will fetch you the Nth maximum value in a column.
select b.column_name from (select distinct column_name from table_name) a,
(select distinct column_name from table_name) b
where a.column_name>=b.column_name
group by b.column_name
having count(b.column_name)=N
-
Friend your answer was good and useful.But I want to know whether there is any predefined function for doing this.
-
Use SELECT MAX(...) .. in db2 query
-
prabhu thanks for your immediate reply.I tried both the suggestion. Can you tell me whether there is any difference in their execution between the two options namely using the predefined function and between the query you gave.
-
Sponsored Ads


Reply With Quote





