当我在MySQL中尝试这个时:
从表中选择make,将(*)计数为num,其中num > 100组,按make
我得到了:
Error Code: 1054, SQL State: 42S22] Unknown column 'num' in 'where clause'有办法限制计数(*)吗?
发布于 2017-09-05 18:14:13
不能在WHERE子句中添加列别名。使用派生表代替:
select make, num
from
(
select make,count(*) as num from TABLE group by make
) dt
where num > 100https://stackoverflow.com/questions/46061007
复制相似问题