热心网友
回答时间:2024-04-27 19:00
MS SQL SERVER中除了
if ()
begin
end
else if ()
begin
end
else
begin
end
以外 还能使用 case when() then() when() then () else () end
收起
热心网友
回答时间:2024-04-27 18:59
if 条件1
then 条件1为真的时候 所做改动
elseif 条件2
then 条件2为真的时候 。。。。。
else 其他情况,统一要做的改动
收起
热心网友
回答时间:2024-04-27 19:05
我觉得你要的是 case when then when then else end 方法, 楼上说的都不对
如
case sex when ‘1’ then ‘男' when '2' then '女' else '其他' end-----简单case函数
case when sex=1 then‘男' when sex=2 then ‘女' else ‘其他' end --------case搜索函数
你就知道这2种方式 是一回事, 就是一个条件 处理
收起
热心网友
回答时间:2024-04-27 18:59
sqlserver可以 其数据库的没接触过
收起
热心网友
回答时间:2024-04-27 19:03
sqlserver
if 条件
begin
查询语句1
end
else
begin
查询语句2
end
像这样
本文如未解决您的问题请添加抖音号:51dongshi(抖音搜索懂视),直接咨询即可。
收起