一道题,不知错哪里
一道题:找出价格最高的产品(PC、笔记本电脑或打印机)的型号
我这样写是对的:
select model from( (select model,price from PC) UNION (select model,price from Laptop) UNION (select model,price from Printer))Mwhere( M.price>=ALL ( select price from ( (select price from PC) UNION (select price from Laptop) UNION (select price from Printer) )R ))
select model from( (select model,price from PC) UNION (select model,price from Laptop) UNION (select model,price from Printer))Mwhere( ALL ( select price from ( (select price from PC) UNION (select price from Laptop) UNION (select price from Printer) )R )<=M.price)
--这是一种语法,就像datepart(day,getdate())一样,你不可以把它放错位置scalar_expression { = | < > | ! = | > | > = | ! > | < | < = | ! < } { ALL | SOME | ANY } ( subquery )