Every derived table must have its own alias

DogJay 2019-05-17 数据库 542人已围观


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

吐槽(0)

文章评论

    共有0条评论

    验证码:

文章目录