给出检查时,此查询可以给出错误

编程入门 行业动态 更新时间:2024-10-23 03:26:39
本文介绍了给出检查时,此查询可以给出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

声明 @ 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

更多推荐

给出检查时,此查询可以给出错误

本文发布于:2023-10-28 01:16:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1535072.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!