wher and having

书写顺序
    select ... from ... where ... group by ... having

执行顺序
    from --> where --> group by --> having --> select
    where在from之后对数据做第一次的筛选
    之后group by聚合并执行聚合函数
    之后having分组筛选

小注:
    having一般对group by的结果进行筛选
    having只能用在group by之后

标签

评论

© 2021 成都云创动力科技有限公司 蜀ICP备20006351号-1