I have lot of MySQL tables with the same column name. So Im looking for PDO or SQL hack for SELECT * FROM more tables - which will return table names in result sets.
Example:
'SELECT * FROM table0, table1';
Where both tables has 'name' column. But FETCH_ASSOC result returns only one 'name' - the last one.
Result:
echo $result["name"];
Wanted result:
echo $result["table0.name"];
echo $result["table1.name"];
...
Note that
- I cannot rename DB columns to be unique
- I cannot manualy create alias for each columns (lot of tables/columns)
- I want name in result set not numbers like FETCH_NUM
Any ideas? Thanks!