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?...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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.
|
![]() |
| Thread Tools | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| FAQ: How to find people's E-mail addresses | David Alex Lamb | Tech FAQ | 1 | 06-24-2007 09:57 AM |
| FAQ: How to find people's E-mail addresses | David Alex Lamb | Tech FAQ | 0 | 05-02-2004 06:30 AM |
| Quarterly ASCII posting of Caldera (SCO) OpenUNIX 8 FAQ | Boyd Lynn Gerber | Tech FAQ | 0 | 04-25-2004 11:11 PM |
| Kerberos FAQ, v2.0 (last modified 8/18/2000) | Ken Hornstein | Tech FAQ | 0 | 04-17-2004 08:28 AM |
| [FAQ] FileMaker Pro - database for Macintosh and Windows | Martin Trautmann | Tech FAQ | 0 | 04-17-2004 08:26 AM |