开发者

SQL Count Function - Need some help

开发者 https://www.devze.com 2023-02-28 14:34 出处:网络
Looking for some help in making an SQL query where: If the value per hour is more than 40 then it will count it and this count will display how many times开发者_如何学Go in that hour the value was ab

Looking for some help in making an SQL query where:

If the value per hour is more than 40 then it will count it and this count will display how many times开发者_如何学Go in that hour the value was above 40.

I am very new to SQL so please forgive my n00bness :)

Thanks!


SELECT Count(*) As myCount FROM myTable WHERE colPerHour > 40

This will return one row with a column called myCount. The value in that cell will be your desired number.


select colperhour, count (*)
from mytable
where colperhour > 40
group by colperhour 

This should give you each value of colperhour greater than 40 (which are in the table), along with the number of times each value exists

0

精彩评论

暂无评论...
验证码 换一张
取 消