【聚合函数的执行顺序:from>where>group by>having>order by>select】
基本是区别一个是在分组后进行过滤(having),一个是在分组前过滤(where)
参考例句:where>——select 【字段名】from 【表名】where 【查询条件id=1】;
having>——select 【字段名】from 【表名】where 【查询条件id=1】group by 【字段名】 having 【条件】
【聚合函数的执行顺序:from>where>group by>having>order by>select】
基本是区别一个是在分组后进行过滤(having),一个是在分组前过滤(where)
参考例句:where>——select 【字段名】from 【表名】where 【查询条件id=1】;
having>——select 【字段名】from 【表名】where 【查询条件id=1】group by 【字段名】 having 【条件】