当前位置: 代码迷 >> Sql Server >> 子查询有关问题
  详细解决方案

子查询有关问题

热度:87   发布时间:2016-04-27 15:06:42.0
子查询问题
当执行
if   (@[email protected])%10=6   and   ((select   P3   from   xue   where   [email protected])   in   (6,7))
显示

消息   512,级别   16,状态   1,第   111   行
子查询返回的值不止一个。当子查询跟随在   =、!=、 <、 <=、> 、> =   之后,或子查询用作表达式时,这种情况是不允许的。
==================

我理解是不能使用in
请教简单的修改,使其可运行和达到原来代码用途。

------解决方案--------------------
if (@[email protected])%10=6 and ( exists (select 1 from xue where [email protected] and P3 in(6,7)) )
  相关解决方案