日期:2014-05-18  浏览次数:20449 次

子查询问题
当执行
if   (@last1+@last2)%10=6   and   ((select   P3   from   xue   where   id=@idN)   in   (6,7))
显示

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

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

------解决方案--------------------
if (@last1+@last2)%10=6 and ( exists (select 1 from xue where id=@idN and P3 in(6,7)) )