查询语句1:select * from table where 条件1 结果为空,则执行查询语句2:select * from table where 条件2。用case when的话有问题,它只能返回一个字段,不能返回结果集。
5条回答 默认 最新
自在猫先生 2022-03-24 13:46关注--条件成立 if exists(select 1 from table where 字段=条件) begin select * from table1 end ELSE begin select * from table2 end评论 打赏 举报解决 1无用