1st table 2nd table
--------------- ----------
|id|name|hours| |id|phour|
--------------- ----------
|1 |samp| 7 | |1 | 10 |
--------------- ----------
|2 |smp2| 1 |
输出
------------------
|phour|name|hours|
------------------
| 10 |samp| 7 |
------------------
| |smp2| 1 |
答案 0 :(得分:0)
尝试以下查询:
select phour, name, hours from table1 right join table2 on table1.id=table2.id