tencent cloud

フィードバック

HAVING Syntax

最終更新日:2024-01-20 17:25:15
    The HAVING syntax is used to filter grouped and aggregated data. The difference between HAVING and WHERE is that HAVING is executed on data after grouping (GROUP BY) and before ordering (ORDER BY) while WHERE is executed on the original data before aggregation.

    Syntax Format

    * | SELECT column, aggregate function GROUP BY [ column name | alias | serial number ] HAVING aggregate function operator value
    The operator can be =, <>, >, <, >=, <=, BETWEEN, IN, or LIKE.

    Syntax Example

    Get URLs whose average response time is greater than 1,000 ms in descending order:
    * |
    select
    avg(responseTime) as time_avg,
    URL
    group by
    URL
    having
    avg(responseTime)> 1000
    order by
    avg(responseTime) desc
    limit
    10000
    The filter condition is the average response time of each URL, which is the aggregate result, and therefore, WHERE cannot be used for data filtering.
    お問い合わせ

    カスタマーサービスをご提供できるため、ぜひお気軽にお問い合わせくださいませ。

    テクニカルサポート

    さらにサポートが必要な場合は、サポートチケットを送信して弊社サポートチームにお問い合わせください。24時間365日のサポートをご提供します。

    電話サポート(24 時間365日対応)