How to fetch result from MySQL row with multiple same-name columns with PHP?

mysql, php, sql

Solution

You probably want to be more explicit in your query. That way you can provide aliases for your columns:

SELECT
  A.foo as a_foo,
  B.foo as b_foo
FROM A
LEFT JOIN B ON A.columnc = B.columnd

Problem

``` select * from A left join B on A.columnc=B.columnd ``` results returned by above SQL will include both columns of A and B. And what if A and B have some columns with the same name? How to retrieve the value from PHP?

Original source

Related problems