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 / mr. cooooool

Hi............

SELECT PRODUCTNAME FROM PRODUCT WHERE COST = (SELECT MAX(COST)
FROM PRODUCT WHERE COST > (SELECT MAX(COST) FROM PRODUCT));

THANKS
REGARDS
RAVINDRA BISHT

Is This Answer Correct ?    13 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is db2 a database?

572


What is a db2 collection?

603


Which are the db2 tools to protect integrity of the database?

688


How to retrieve rows from a db2 table in embedded sql?

721


I understand Join always perform better than subqueries. Then what is the advantage/use of Subqueries/correlated subqueries etc.,in DB2 programming.Please explain.

1646






What is meant by union and union all?

583


What db2 400?

675


What is the role of schema in the db2 database?

649


Is the primary key a clustered index?

607


When reorg is used?

670


What are the various isolation levels possible?

645


What is the default page size of buffer pools?

644


What is null value in db2?

563


How to find schema of a table in db2?

570


How to execute stored procedure in db2 command editor?

528