The query and analysis function of Log Service supports the Having syntax of standard SQL, which is used together with the GROUP BY syntax to filter the GROUP BY results.

Format:
method :PostLogstoreLogs |select avg(latency),projectName group by projectName HAVING avg(latency) > 100

Difference between HAVING and WHERE

HAVING is used to filter the aggregation and calculation results after performing GROUP BY. WHERE is used to filter the original data during the aggregation calculation.

Example

Calculate the average rainfall of each province whose temperature is greater than 10℃ and only display the provinces whose average rainfall is greater than 100 mL in the final result:

* | select avg(rain) ,province where temperature > 10 group by province having avg(rain) > 100