sql server
mwl0work
这个作者很懒,什么都没留下…
展开
-
left join on 后Null转为int的使用
select a.tillid,num1+isnull(num2,0) FROM (select tillid,sum((qty + 99)/100) num1 FROM dstrans2 WHERE txdate = '2012-09-30' AND qty > 0 group by tillid) a left jo原创 2012-10-16 22:16:54 · 209 阅读 · 0 评论 -
case where then 的使用
select tillid ,sum(num) from (select tillid,case when qty > 0 then (qty + 99)/100 when qty end as num FROM dstrans2 WHERE txdate = '2012-09-30') a group by tillid原创 2012-10-16 22:15:53 · 297 阅读 · 0 评论