结果集中的列值未被覆盖

Column values are not overriden in result set

HeidiSQL不覆盖结果集中应该覆盖的字段是标准行为吗?

I 运行 SQL查询,其中两个table有相同的字段,一个table是main,另一个是from join。我必须 select 来自 main table 的所有字段(例如使用“*”),并且来自 joined table 的一些字段必须覆盖 main table 的值。当我们使用 PDO 获取结果时它确实有效(因为结果我们得到了一个具有相同键的数组值覆盖了前一个)。但是在 HeidiSQL 我得到了这个:

好的,自己搞定了。 根据文档:

MySQL permits duplicate column names. That is, there can be more than one select_expr with the same name. This is an extension to standard SQL. Because MySQL also permits GROUP BY and HAVING to refer to select_expr values, this can result in an ambiguity:

SELECT 12 AS a, a FROM t GROUP BY a;

In that statement, both columns have the name a. To ensure that the correct column is used for grouping, use different names for each select_expr.

以前没重视过这个