请求带有计数和分组的功能

huangapple go评论139阅读模式
英文:

Request with count and group by

问题

select id_person
from table
where date is null
group by id_person
having count(id_person) > 1000
英文:
id id_person id_equipement date
1 1 250 [date_1]
2 2 250 [date_2]
3 3 50 null
4 2 50 [date_3]

I want to get the id of every person for which there is more than 1000 line and the date is null.

I tried with :

select id_person  
from table 
where date is null
group by id_equipement 
having count(is_equipement) > 1000

答案1

得分: 1

select id_person
from table
where date is null
group by id_person
having count(id_person) > 1000

英文:

You can try this as you need the id of persons appearing more than 1000 times

select id_person  
from table 
where date is null
group by id_person
having count(id_person) > 1000

huangapple
  • 本文由 发表于 2023年3月9日 16:40:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/75682160.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定