我想知道 MySQL 是否为您正在构建的当前表提供某种默认别名(如 SmallTalk 中的“self”或 Java 中的“this”)。例如:
SELECT
SUM(revenue) AS revenue,
SUM(units) AS units,
SUM(revenue)/SUM(units) AS revPerUnit,
-- I want to replace the above line with the below line:
self.revenue/self.units AS revPerUnit2
FROM inputTable;
我知道我可以只使用明确的别名,但我想知道是否有一种方法可以在存在不明确的定义时指定您想要当前表的别名。