Search code examples
mysqlsqlmysql-error-1060

#1060 - Duplicate column name 'id'


Why I get #1060 - Duplicate column name 'id'

SELECT COUNT(*) FROM (SELECT * FROM `tips` `t` LEFT JOIN
tip_usage ON tip_usage.tip_id=t.id GROUP BY t.id) sq

Solution

  • Probably because the * in select * selects two columns with the same name from tip_usage and tips.