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 / siri

select productname from product p where 2=(select count(*) from product q where p.cost<=q.cost)

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the maximum No of rows per page?

710


What is package in db2 mainframe?

638


How do you simulate the explain of an embedded sql statement in spufi/qmf?

725


What is the difference between dbm cfg and db cfg file in db2 ?

1106


Give the name of some fields form sqlca.

700






For a db2 column that is being defined as decimal (11, 2), discuss the cobol picture clause.

752


Why do we bind in db2?

738


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

1737


What is db2 plan table?

712


have 3 tables table1, table2 and table3 which contains employee information. table1 is master table, table2 contains emp details like emp no and so on, table 3 contains emp salary. so if any emp leave company between 25th - 30th of every month it has to get updated in tables. but it is not getting updated. What is the reason.

1362


Is it possible using max on a char column?

703


What are the full forms of spufi and dclgen and why are they used?

735


What is with ur in db2?

886


What is a cursor in programming?

697


Hello All, We have requirment to Replace BMC Db2 Load product thru CA FAST LOADPlus product. Do anyone have JCL to for FAST LOADPLUS and what all are thing need to take in consideration.

2417