我有两个疑问
select a,b,c,count(d) as first_count from
test
group by a,b,c
having (count(c)>1)
第二个
select a,b,c,count(d) as second_count from
test
group by a,b,c
having (count(c)>100)
如何在一个查询中执行上述操作,以便在我的结果中具有以下列:a,b,c,count(d) as first_count,count(d) as secondary_count
最佳答案
也许这会对你有帮助
select a,b,c,(select count(d) from test having (count(c)>1) ) as first_count,
(select count(d) from test having (count(c)>100) ) as second_count
FROM test
group by a,b,c
关于mysql - 在查询中使用having子句两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22463927/