开发者

How to do this in a mysql query

I have got a mysql table containing data about companies: id, company name, city, address, telephone.

I'm trying to write a quer开发者_高级运维y for getting list of cities where there are more then 10 companies within.

Is it possible to achieve that?


Try

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


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜