Every derived table must have its own alias


MySQL中执行如下嵌套子查询时报错

select 
    tag_id
from(
     select tag_id,count(blog_id) as counts  from bg_blog_tag group by tag_id
) 
order by counts desc
limit 0,30

报错如下:

错误代码: 1248

Every derived table must have its own alias

意思是派生出来的表需要有自己的别名。

解决方法: 将子查询派生的表赋予别名即可

select tag_id
from(
select tag_id,count(blog_id) as counts  from bg_blog_tag group by tag_id
) 
order by counts desc
limit 0,30

全部评论

联系我们

025-66041049

在线咨询:点击这里给我发消息

邮件:face2obejct@gmail.com

工作时间:8:00-23:50

QR code