group by where条件的设置

发表于 2017-07-01 14:31:05 | 只看该作者 |倒序浏览 |阅读模式
group by where条件的设置
/*
where要放在group by前面
group by 后面加条件只能用having关键字
*/
select case_id, count(*) from td
inner join TD_PROC proc
on td.wf_proc_id = proc.businessid
and proc.type != ’done’
where case_id is not null --where要放在group by前面
group by case_id
--可用having case_id is not null