基本上到目前为止,我已经设法制作了这个:
sqlite> SELECT city, COUNT(bname) AS sum FROM building GROUP BY city;
city sum
---------- ----------
Leeds 3
London 1
New York 2
Paris 1
但是我想做的只是打印总和> 1的城市。我试过这个:
sqlite> SELECT city, COUNT(bname) AS sum FROM building WHERE sum>1 GROUP BY city;
但我得到了错误:
Error: misuse of aggregate: COUNT()
有人可以解释为什么这不起作用,而是我应该做什么?谢谢