英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论