Exforsys
+ Reply to Thread
Results 1 to 5 of 5

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?...

  1. #1
    cyrus is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    128

    To find Maximum

    I want to find the maximum value in a column in db2. How can I do this?


  2. #2
    gpraveen_mca is offline Junior Member Array
    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


  3. #3
    rachelle is offline Member Array
    Join Date
    Apr 2006
    Answers
    97
    Friend your answer was good and useful.But I want to know whether there is any predefined function for doing this.


  4. #4
    Prabhu N is offline Junior Member Array
    Join Date
    Feb 2006
    Answers
    14
    Use SELECT MAX(...) .. in db2 query


  5. #5
    cyrus is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    128
    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



Latest Article

Network Security Risk Assessment and Measurement

Read More...