java 发表于 2018-3-27 15:30:19

常用查询语句

本帖最后由 java 于 2018-3-28 10:45 编辑

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

SELECT distinct template, count(1) as count FROM domainconfiggroup by templateand template='user' order by count desc

java 发表于 2018-5-21 11:38:18

where执行顺序是从左往右执行的,

遵守原则:排除越多数据的条件放在第一个。
页: [1]
查看完整版本: 常用查询语句