I have a table(product),It contain fields(productname,cost).
I want to retrieve the product name ,which cost is second
maximum in the table?
Answer Posted / rajasekaran
with e as (select product_name,cost,rank() over(order by
cost desc) as rk from product) select * from e where rk=2;
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Can you use max on a char column?
i tried to copy some records from microsoft excel to as-400 physical file through "Bosanova" emulation. Out of 14000 records only 12000 records copies and subsequently programe started to hang. Then, i closed the program forcefully. I did' under stand the problem. Also when i try to compile the physical file it is showing as "The file in use". How to overcome this problem?
Following a db2 update statement, what is the quickest way to compute the total number of updated rows?
What is the difference between oracle and db2?
What is database manager in db2?
What is the difference between cursor and select statement?
When the like statement is used?
What is db2 bind process?
What is the difference between nvl and coalesce?
How do I delete a table in database?
What is a db2 tablespace?
How to test SQL -911 error while developing COB-DB2 program
How do you eliminate duplicate values in db2?
What is bind package and plan in db2?
What is the use of value function?