firemail

标题: 常用查询语句 [打印本页]

作者: java    时间: 2018-3-27 15:30
标题: 常用查询语句
本帖最后由 java 于 2018-3-28 10:45 编辑

分组统计数量
SELECT distinct status, count(*) FROM xxx_table group by status

SELECT distinct template, count(1) as count FROM domainconfig  group by template  and template='user' order by count desc

作者: java    时间: 2018-5-21 11:38
where执行顺序是从左往右执行的,

遵守原则:排除越多数据的条件放在第一个。




欢迎光临 firemail (http://www.firemail.wang:8088/) Powered by Discuz! X3