SQL Select * from multiple tables

Posted by zaf on Stack Overflow See other posts from Stack Overflow or by zaf
Published on 2010-03-26T13:41:15Z Indexed on 2010/03/26 13:43 UTC
Read the original article Hit count: 329

Filed under:
|
|
|

Using PHP/PDO is it possible to use a wildcard for the columns when a select is done on multiple tables and the returned array keys are fully qualified to avoid column name clash?

example:

SELECT * from table1, table2;

gives:

Array keys are 'table1.id', 'table2.id', 'table1.name' etc.

I tried "SELECT table1.*,table2.* ..." but the returned array keys were not fully qualified so columns with the same name clashed and were overwritten.

© Stack Overflow or respective owner

Related posts about php

Related posts about sql