2010-02-17 5 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 
시도
관련 문제