tags:

views:

25

answers:

2

I have got an mysql table containing data about companies: id, company name, city ,address, telephone. I'm trying to write a querry for getting list of cities where there are more then 10 companies within. Is it possible to achieve that?

+2  A: 

Try

select city, count(*) as nbPerCity from tableName group by city having nbPerCity > 10;
Dominik
+2  A: 
select city from Table group by city having count(company_name) > 10 ;

or

select s.city from 
   (select city,count(company_name) as counted from Table group by city) as s
where s.counted > 10
nos