每个派生 table 必须有自己的别名?这怎么错了

Every derived table must have its own alias? How is this wrong

我已经给派生的 table 一个别名,但是当我 运行 查询时它仍然给我错误 "Every derived table must have its own alias".

select a,b,c,sum(d) as 'sum'
from(select a,b,c,sum(d)as 'd' from e join f using(z)) as 'alias'
group by a;


EDIT: better sample
----This gives derived table error-----
select name,sum(pop) as 'total' from(select name as 'name',sum(population) 
as pop from table1 join table2 using(countrycode));

----This gives me the SQL syntax error--------
select name,sum(pop) as 'total' from(select name as 'name',sum(population) 
as pop from table1 join table2 using(countrycode)) as 'alias';

提前致谢。

试试这个:

select name,
       sum(pop) as `total` 
from( 
        select name as `name`, sum(population) as pop 
        from table1 
        join table2 using(countrycode)
) `m` <---- alias needed here too