Hi there,
I'm running a query in MYSQL using LEFT JOIN to get users and their user groups. Both tables have columns named id. My result is being returned in an array (PHP) so that I have one array with all field data, but also only one array["id"].
Here's my query so far:
SELECT usr.id, usg.id FROM users usr LEFT JOIN (user_groups usg) ON (usg.id=usr.group_id)
Now the easy solution would be to rename the fields to unique names like usr_id and usg_id but I prefer not to. I would much rather have my values returned to the array as array["usr.id"] automatically.
(I'm using the CodeIgniter framework which automatically does the rest, but I could rewrite some stuff there if only MySQL could return the table alias with it)