I don’t think it’s possible but I thought I would ask anyways.
I have a MySql 5.+ query as such…
SELECT p.*, u.* FROM princess p JOIN unicorn u ON p.id = u.princess_id
It’s kind enough to return me all of the princesses and unicorns ;). The problem is that the returned result set may contain duplicate column names (not good). If both tables have a column named name how can I differentiate it without explicitly coding the alias like p.name as 'princess_name' and u.name as 'unicorn_name'?
Also, I can’t use the column index so if there isn’t a better way I’ll just hand code all the aliases myself.
SELECT *is bad idea for several reasons, one of which you’ve just found. Use an explicit column list and create your own aliases.