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 / viki
SELECT PRODUCTNAME FROM PRODUCT WHERE COST <> max(COST)
AND PRODUCTNAME=
(SELECT PRODUCTNAME FROM PRODUCT WHERE COST =
(SELECT COST FROM PRODUCT
ORDER BY COST DESC
FETCH FIRST TWO ROWS ONLY))
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the difference between "db2ilist" and "db2 get instance" commands in DB2 Database Server?
what are bind concepts in db2 cobol?
What is dbrm? When it will be created?
What is db2 purescale?
What does db2 blu stand for?
Hi, i would like to start a new carrier in DB2 DBA.Which and what all step should i have to take..?
How do I add a column to a table in db2?
What is check constraint in db2?
in my project..TEST is db2 8.1 version In PROD it is 7.1 if i do REORG in TEST.. can I use the same REORG jcl with out modification in PROD region (this is DB2 8.1 )? if not, what modification i need to do in my REORG control card?
I HAVE 500 ROW TO UPDATE I WOULD LIKE TO USE ROLLBACK ALONG WITH COMMIT.WHAT IS THE SYNTAX TO CODE COMMIT AND ROLLBACK FOR EVERY 100 ROWS.AND HOW THE CURSOR ROLLBACK TO THE LAST COMMITTING POINT.
SQLCODE = -199, ERROR: ILLEGAL USE OF KEYWORD CHAR, TOKEN KEY was expected
Which command is used to remove all rows from a table?
What are the various isolation levels possible?
Why do we bind in db2?
What is a trigger in the db2 database?