字段sgjd_bm为vachar型
select
sum( case when a.sgjd_bm='1510' then 1 else 0 end)
from zscsg_jd a,zscsg_jdbc b
where a.jh = b.jh and sgjd_bm='1510' and bc_rq='2009-11-30'
select
sum( case when a.sgjd_bm='1510' then 1 else 0 end)
from zscsg_jd a,zscsg_jdbc b
where a.jh = b.jh and sgjd_bm='1510' and bc_rq='2009-11-30'
本文探讨了在SQL查询中如何正确使用varchar类型字段进行条件筛选,并通过具体案例展示如何结合case when语句实现特定条件计数。
1万+

被折叠的 条评论
为什么被折叠?



