SQL Select * from multiple tables

前端 未结 5 1729
[愿得一人]
[愿得一人] 2020-12-05 15:35

Using PHP/PDO/MySQL 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

5条回答
  •  无人及你
    2020-12-05 15:53

    you can do this:

    SELECT Table1.*,Table2.xyz, Table2.abc,... From...
    

    where you get all columns from one table using "*" and then just the columns from the other table you need, so there is no clash.

    You could also use column aliases, where you "rename" a column:

    SELECT Table1.A AS T1_A,Table2.A AS T2_A,... From...
    

    your result set would be of columns T1_A and T2_A

提交回复
热议问题