What is the error “Every derived table must have its own alias” in MySQL?

后端 未结 4 1583
小鲜肉
小鲜肉 2020-11-21 09:07

I am running this query on MySQL

SELECT ID FROM (
    SELECT ID, msisdn
    FROM (
        SELECT * FROM TT2
    )
);

and it is giving this

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-21 09:26

    I think it's asking you to do this:

    SELECT ID
    FROM (SELECT ID,
                 msisdn 
          FROM (SELECT * FROM TT2) as myalias
         ) as anotheralias;
    

    But why would you write this query in the first place?

提交回复
热议问题