MYSQL ERROR 1248 (42000): Every derived table must have its own alias

Deadly 提交于 2019-11-29 06:30:49

It means exactly what it says - each derived table must have an alias. SELECT a.* FROM (SELECT ....)a

Update. This should work for you:

SELECT xxx.* FROM 
(
    SELECT ....
    FROM ....
    UNION
    (
       SELECT ....
       FROM .....
       LIMIT 46
    )
    LIMIT 50
)xxx

The very first line of your query is

SELECT * FROM 

which appears to be unnecessary (as all three UNIONed queries already include SELECT and FROM clauses).

Removing this unnecessary line should resolve the problem; alternatively, adding a ( just after the first line, and adding a ) QRYALIAS at the end would also resolve the problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!