求sql2005一个sql语句 在表中有两个字段,a和b都是int型的,当a=0时返回0,当a!=0时计算当a>b时返回1,其他返回0谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select case when a=0 then 0 else case when a>b then 1 else 0 end from tb select case when a = 0 then 0 when a <> 0 and a> b then 1 else 0 endfrom tb select case when a!=0 and a>b then 1 else 0 end from tb ...select case when a = 0 then 0 when a <> 0 and a> b then 1 else 0 end from tb 实际上这样即可.select case when a <> 0 and a> b then 1 else 0 end from tb 麻烦大家不要再这样说了 如何用批处理修改SQL表内的值 sql 查询问题 数据库结构一样,如何导数据? 一个奇怪的问题。 创建表出现异常提示 sql数据库请教 请求sql大神们帮帮我啊 使用bcp的疑问.在线等待!!!!!!!!! 求sql server开发存储过程书籍下载 如何判断某时间段是否包括在某时间段之内? 请教sql基础问题
case when a>b then 1 else 0 end from tb
when a <> 0 and a> b then 1
else 0
end
from tb
select case when a!=0 and a>b then 1 else 0 end from tb
case when a = 0 then 0
when a <> 0 and a> b then 1
else 0
end
from
tb