[英]Oracle SQL Developer 0913 - too many values
I'm trying to return the MINIMUM VALUE and the MAXIMUM VALUE in my PRICE table(the field is the val_price). 我试图在我的PRICE表(该字段为val_price)中返回MINIMUM VALUE和MAXIMUM VALUE。 What is the problem with this query?
此查询有什么问题?
select des_price, val_price from price
WHERE val_price IN
(SELECT MIN(val_price), MAX(val_price) from price);
The error message is: 错误消息是:
00913. 00000 - "too many values" 00913. 00000-“值太多”
*Cause: *原因:
*Action: *行动:
If I try with just one value in the inner select everything works fine, but with multiple values I don't know why is not working. 如果我尝试仅在内部使用一个值,则一切正常,但是对于多个值,我不知道为什么不起作用。 This example works fine with 2 values in the follow inner select:
该示例在以下内部选择中使用2个值可以正常工作:
UPDATE price SET val_price = val_price * 1.05
WHERE des_price in('NORMAL','RELEASE');
You cannot select two columns from sub-query
when you are using only one column in Where
clause 在
Where
子句中仅使用一列时,无法从sub-query
选择两列
Try this way 试试这个
SELECT des_price,
val_price
FROM price
WHERE val_price IN (SELECT Min(val_price)
FROM price
UNION ALL
SELECT Max(val_price)
FROM price);
or 要么
SELECT des_price,
val_price
FROM price
WHERE ( val_price, val_price ) IN (SELECT Min(val_price),
Max(val_price)
FROM price)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.