Details
-
Task
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
None
Description
With JOINs, sometimes we get this error:
ERROR 1052 (23000): Column 'ENGINE' in where clause is ambiguous |
It happens because multiple tables share the same column name, and we did not reference it in the form `table`.`column`. But sometimes the user didn't because he doesn't think it's necessary, and from a purely logical point of view he's right. I can think at least 2 cases.
1) Think this ON:
ON t1.id = t2.id |
If we are only joining t1 and t2, the values are identical.
2) Think about a semi-join:
ON t1.id = t2.id |
WHERE t2.name IS NULL |
ORDER BY name |
Unless we are joining more tables, we mean ORDER BY t1.name. I know that the language allows us to order by a constant NULL value. But in a real case semi-join it seems to me perfectly safe to assume that we are referencing a column from t1.