2010-02-17 62 views
0

我有一个包含公司数据的mysql表格:id, company name, city, address, telephone如何在mysql查询中做到这一点

我正试图编写一个查询来获取其中有10多家公司的城市列表。

是否有可能实现这一目标?

回答

2

尝试

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

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