老大们救名!!!!!!!!!!!!!!!!!!!

IDWB 2004-02-16 03:02:51
declare @SF bit,
@YHLB bit
set @SF=1
set @YHLB=1

select * from yonghu_info
where YHID in (case when @SF is not null or @YHLB is not NULL then
(select DISTINCT YHH from ZYGX
where WYFSF=(case when @SF is not NULL then @SF else WYFSF end)
and WYFFS=(case when @YHLB is not NULL then @YHLB else WYFFS end)
)
else YHID end
)


当@SF=1 @YHLB=1 或 @SF=1 @YHLB=null 或 @SF=null @YHLB=1
就会出错:Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

而当@SF=0 @YHLB=0 或 @SF=1 @YHLB=0 或 @SF=0 @YHLB=1 或 @SF=null @YHLB=null 时都正确
这到底是为什么啊!!!!!5555555555555555555555555555
...全文
118 11 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复

34,838

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧