本文介绍了错误“每个派生表必须具有其自己的别名"是什么?在MySQL中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在MySQL上运行此查询
I am running this query on MySQL
SELECT ID FROM (
SELECT ID, msisdn
FROM (
SELECT * FROM TT2
)
);
,并且出现此错误:
是什么原因导致此错误?
What's causing this error?
推荐答案
每个派生表(AKA子查询)确实必须具有别名. IE.括号中的每个查询都必须被赋予一个别名(AS whatever
),该别名可在外部查询的其余部分中用于引用它.
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
这篇关于错误“每个派生表必须具有其自己的别名"是什么?在MySQL中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!