group by where条件的设置
2012-06-07 15:57
239 查看
/*
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
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
相关文章推荐
- mysql group by内排序的实现以及having和where 条件语句查询的区别
- 常用查询条件\分组 group by\having和where的区别\union查询
- mysql 数据库中 WHERE / ORDER BY/GROUP BY/LIMIT 几个限制条件的排序
- 步步为营VS 2008 + .NET 3.5(5) - LINQ查询操作符之Select、Where、OrderBy、OrderByDescending、GroupBy、Join、GroupJoin及其对应的查询语法
- 查询语句中select from where group by having order by的执行顺序
- order by/group by/having/where/sum/count(*)...查询结果筛选关键字
- where group by having
- 针对GROUP BY 设置限制条件,则不能使用Where 子句,必须使用HAVING 子句来设置。
- Oracle基础知识(5)--select...from...where...group by...having...order by...
- where group by having
- where group by having这个顺序问题
- sql where group by having order by
- The execute sequence when using the WHERE and GROUP BY Clauses Together
- 设置block的where条件并执行查询
- 查询语句中select from where group by having order by的执行顺序
- oracle数据库中where条件后各个条件的优先级,比如order by, group by,having之类
- 查询语句中select from where group by having order by的执行顺序
- 初学oracle--groupby+where与having
- SQL Server 和 MySQL中 from where group by having order select 执行顺序
- 步步为营VS 2008 + .NET 3.5(5) - LINQ查询操作符之Select、Where、OrderBy、OrderByDescending、GroupBy、Join、GroupJoin及其对应的查询语法