给出检查时,此查询可以给出错误 [英] this query can given error given check it
本文介绍了给出检查时,此查询可以给出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
声明 @ Price nvarchar ( 200 )
set @ Price =(选择 MIN(价格)[Min],MAX(价格)[Max] 来自
(选择 Day_Price 价格来自 t_CoachDetails
union
选择 Round_Price as price 来自 t_CoachDetails
union
选择 Destination_Price 作为价格来自 t_CoachDetails) as pric)
选择 @ Price
错误给出
--------------
Msg 116 ,等级 16 ,状态 1 ,行 8
只能在中指定一个表达式 -keyword>选择列表当子查询 不引入 EXISTS 。
解决方案
- 设置一个表达式在您的子查询中,
声明 @ Price nvarchar ( 200 )
set @ Price =(选择 MIN(价格)[Min] 来自
(选择 Day_Price 作为价格来自 t_CoachDetails
union
选择 Round_Price as 价格来自 t_CoachDetails
union
选择 Destination_Price 作为价格来自 t_CoachDetails) as pric)
选择 @ Price
declare @Price nvarchar(200)
set @Price = (select MIN(price) [Min], MAX(price) [Max] from
(select Day_Price as price from t_CoachDetails
union
select Round_Price as price from t_CoachDetails
union
select Destination_Price as price from t_CoachDetails)as pric)
select @Price
error given
--------------
Msg 116, Level 16, State 1, Line 8
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
解决方案
-- set one expression in your sub query, declare @Price nvarchar(200) set @Price = (select MIN(price) [Min] from (select Day_Price as price from t_CoachDetails union select Round_Price as price from t_CoachDetails union select Destination_Price as price from t_CoachDetails)as pric) select @Price
这篇关于给出检查时,此查询可以给出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文