Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例子:
SELECT * FROM T1 JOIN T2 on (T1.id = T2.id as aux)
我试图别名的地方T2.id as aux- 但这会引发错误
T2.id as aux
...
这样生成的提取列将具有 aux 的列名,而不仅仅是 id 。
没有办法像这样对列进行别名。您可以在子查询中执行此操作,但实现您想要的正确方法是显式列出投影列,无论如何这是一种很好的风格。所以:
SELECT T1.id, T2.id as aux, T1.col1, T2.col2 [,...] FROM T1 JOIN T2 on T1.id = T2.id