I was wondering why the request
select * from (select * from users join users a) b
causes an error Duplicate column name? Although the inner query returns a result set with repeating columns marked _1, the outer one shows the column from the table.
Duplicate column name
This is the correct behavior because any columns in the subquery selection list must have a unique name ( Subqueries in the From section ). You can also check here , it was a bug in older versions of mysql that allowed you to do this.
columns in a subquery may have unique names, so do this
select a.id, b.id, a.col1, b.col2, b.col3 from (select a.col1, a.id from users join users a) b
where id, col1, col2, col3 are the column names that I composed
Source: https://habr.com/ru/post/1762685/More articles:Reorder date with javascript - javascriptCan an iPhone application write files? - iphonemysql создает триггер в базе данных, прослушивая изменения таблицы в другой базе данных - sqlCSS problem with box shadow and floating box - htmlBreak Project WCF RIA Services - .netDoes the HAML block return "0" on output? - yieldHow to inherit / extend styles from a resource dictionary? - .netWord XML Programming in .NET - .netIs it better to delete or declare new temporary tables for SQL stored procedures? - sql-serverHow do I know if a Python.Lock multiprocessor is released or not? - pythonAll Articles