什么是错误“每个派生表必须有自己的别名"?在 MySQL 中?
我在 MySQL 上运行这个查询
I am running this query on MySQL
SELECT ID FROM (
SELECT ID, msisdn
FROM (
SELECT * FROM TT2
)
);
它给出了这个错误:
每个派生表都必须有自己的别名.
Every derived table must have its own alias.
是什么导致了这个错误?
What's causing this error?
推荐答案
每个派生表(AKA 子查询)确实必须有一个别名.IE.括号中的每个查询都必须有一个别名(AS 不管
),它可以用于在外部查询的其余部分中引用它.
Every derived table (AKA sub-query) must indeed have an alias. I.e. each query in brackets must be given an alias (AS whatever
), which can the be used to refer to it in the rest of the outer query.
SELECT ID FROM (
SELECT ID, msisdn FROM (
SELECT * FROM TT2
) AS T
) AS T
当然,在您的情况下,整个查询可以替换为:
In your case, of course, the entire query could be replaced with:
SELECT ID FROM TT2
相关文章