0

When I try this in MySQL:

select make,count(*) as num from TABLE where num > 100 group by make

I got:

Error Code: 1054, SQL State: 42S22]  Unknown column 'num' in 'where clause'

Is there a way to limit count(*)?

Tony
  • 603
  • 5
  • 9
  • 17

1 Answers1

0

You can't put column aliasas in the WHERE clause. Use a derived table instead:

select make, num
from
(
    select make,count(*) as num from TABLE  group by make
) dt
where num > 100
jarlh
  • 42,561
  • 8
  • 45
  • 63