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
Probably because the * in select *
selects two columns with the same name from tip_usage
and tips
.
Probably it's because the inner select yields two columns with the name id
. Since you are not using those columns, you can just change the select to:
SELECT COUNT(*) FROM (SELECT t.id FROM `tips` `t`
LEFT JOIN tip_usage ON tip_usage.tip_id=t.id
GROUP BY t.id) sq
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With