我有下表
+-----+------+
| sID | name |
+-----+------+
| 2 | MXX |
| 3 | ISS |
| 4 | FSS |
| 5 | SSA |
| 6 | PSA |
+-----+------+
和下表
+-----+-------+
| sID | pname |
+-----+-------+
| 1 | qqq |
| 1 | yyy |
| 2 | zzz |
| 1 | lll |
| 2 | mmm |
| 3 | ttt |
| 3 | sss |
| 5 | xxx |
| 5 | iii |
+-----+-------+
并且连接结果应该看起来像
+-----+-------+----------+
| sID | pname | supplier |
+-----+-------+----------+
| 1 | qqq | |
| 1 | yyy | |
| 2 | zzz | MXX |
| 1 | lll | |
| 2 | mmm | MXX |
| 3 | ttt | ISS |
| 3 | sss | ISS |
| 5 | xxx | SSA |
| 5 | iii | SSA |
+-----+-------+----------+
想法是将第一个表中的列值放在name
第二个表中sID
相同的位置
我试过Select * From TABLE1 c LEFT join TABLE2 T on c.sID=T.sID