第一题花了太多时间了,最后只会很笨的方法: drop table if exists t0; drop table if exists t1; drop table if exists t2; create table t0 as (select id from fw_advertiser where industry='Car&(14116)#39;); create table t1 as select fwa.name, count(fwc.duration) as total from fw_creative as fwc join fw_advertiser as fwa on fwc.advertiser_id=fwa.id where fwc.duration <= 20 group by fwa.id having fwa.id in (select * from t0); create table t2 as select fwa.name, count(*) as yes from fw_creative as fwc join fw_advertiser as fwa on fwc.advertiser_id=fwa.id group by fwa.id having fwa.id in (select id from fw_advertiser where industry='Car&(14116)#39;); select t1.name as advertiser_name, t2.yes / t1.total as percentage from t1 join t2 on t1.name = t2.name; 第二题就是层次遍历就行了。 第三题没时间看