select p_product
from (select p_product, count(p_product)
from rental
group by p_product
order by count(p_product) desc LIMIT 5);
错误:每个派生表都必须有自己的别名
答案 0 :(得分:1)
为子查询添加别名:
select p_product
from (
select p_product,
count(p_product)
from rental
group by p_product
order by count(p_product) desc LIMIT 5
) t;
------^ here
另外,你真的不需要子查询:
select p_product
from rental
group by p_product
order by count(p_product) desc LIMIT 5