美文网首页
sqlite(17)-Having子句

sqlite(17)-Having子句

作者: Flannery | 来源:发表于2016-06-15 18:01 被阅读0次

    Having子句允许指定条件来过滤将出现在最终结果的分组结果。
    WHERE子句在所选列上设置条件,而Having子句则在由Group By子句创建的分组这是条件。

    语法#

    SELECT
    FROM
    WHERE
    GROUP BY
    HAVING
    ORDER BY


    SELECT column1, column2
    FROM table1, table2
    WHERE [conditions]
    GROUP BY column1, column2
    HAVING [conditions]
    ORDER BY column1, column2

    实例#

    样例表

    SELECT * FROM COMPANY GROUP BY name HAVING count(name) < 2;

    相关文章

      网友评论

          本文标题:sqlite(17)-Having子句

          本文链接:https://www.haomeiwen.com/subject/sahpdttx.html