Can some one please tell me the correct way to write a SQL statement for the above Question.
I am doing this, but it shows Sql command not properly ended. I am using SQL *PLUS.
PRODUCT
is the table name.
SELECT PROD_NAME FROM PRODUCT ORDER BY MFG_DATE DESC
(SELECT PROD_NAME FROM PRODUCT GROUP BY PRICE HAVING
COUNT(MFG_DATE)>1
ORDER BY
MFG_DATE DESC)
CodePudding user response:
If I get it right, all you need to do is to specify the "price" column on the second place in the order by part:
select *
from product
order by mfg_date desc, price desc;
CodePudding user response:
The way you explained it in the title, that would be
select prod_name
from product
order by mfg_date, price desc
(BTW, this is Oracle; SQL*Plus is its command-line tool).