Q:

Mysql query SELECT with same name fields

I have table1 and table2 in a Mysql database. 
Each table has a field with the same name, let's say "id".
I need a query where I can get the "id" field value of both tables. I tried this:
 SELECT 
   table1.id,
   table2.id
 FROM... 

But I got an error message: 

Unknown column 'table1.id' in 'field list'

A:

you need to add ALIAS on the columns 
 SELECT 
   table1.id AS table1_ID,                              -- keyword AS is optional
   table2.id AS table2_ID
 FROM...

and call their alias (for example) $row["table1_ID"] in PHP .
on more thing Unknown column 'table1.id' in 'field list' results from columns that are unable to be find by the server on your join statements.
follow-up question, can you post the whole query?

