我有一个关于子查询的问题。但是我尝试了不同的方法,我仍然无法正确的语法。所以请帮忙。
我有一张这样的桌子
DD_Products
(
ProductID
Description
ProductPrice
RetailPrice
LaborEST
);
并尝试查看列表 10
利润最高的产品(销售价值和成本之间的差异)。
所以我这样创造
CREATE VIEW Top10money_VW AS
SELECT ProductID,Money
FROM (select *
from DD_Products
Order by ProductPrice - RetailPrice AS Money desc)
Where ROWNUM <= 10;
但它说
Error starting at line 1 in command:
CREATE VIEW Top10money_VW AS
SELECT ProductID,Money
FROM (select *
from DD_Products
Order by ProductPrice - RetailPrice AS Money desc)
Where ROWNUM <= 10
Error at Command Line:5 Column:43
Error report:
SQL Error: ORA-00907: missing right parenthesis
00907. 00000 - "missing right parenthesis"
*Cause:
*Action:
什么是正确的语法?