sql server 2008 UNION 语句 合用 if语句???

xue1234567890 xue1234567890 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
declare @a char(20)

select * from AAA
union all
if @a=1
begin
select * from BBB
end
Else
begin
select * from CCC
and
union all
select * from DDD


一直报 语法错误,该怎么写?

...全文

相关推荐

评论 8
收藏 已收藏
分享
返回顶部
xue1234567890
应用实例 27,579 成员 68,540 内容