2010-02-17 61 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