USE lhh;
SELECT c.name, count(*)
FROM lhhdata AS l
INNER JOIN `citydata` AS c
ON l.`area_id`=c.`id`
WHERE l.`bankname` LIKE "南京银行%"
GROUP BY c.name
ORDER BY count(*) desc;
看来南京银行是真想当南京一霸
USE lhh;
SELECT c.`name` 城市,count(*) 工行支行数量
FROM `lhhdata` AS l
INNER JOIN `bankdata` AS b
ON b.`bank_id`=l.`bank_id`
INNER JOIN `citydata` AS c
ON c.`id`=l.`area_id`
WHERE b.`bank_id`=1
GROUP BY c.`name`
ORDER BY count(*) DESC
LIMIT 12;
Comments | NOTHING