我想從兩個表中選擇數據。
- 倉庫有兩列:warehouseId,warehouseName
- 交通有三列:轉運,warehouseId1,warehouseId2
我想從兩個表中選擇並從warehouseId1和warehouseId2 表A中得到warehouseName這裏是我的代碼,但它不起作用。如何選擇不同條件的同一列?
select a.transporter, b.warehouseName as warehouse1, b.warehouseName as warehouse2
from transportation a, warehouse b
where a.warehouseId1 = b.warehouseId and a.warehouseId2 = b.warehouseId
它的作品,非常感謝! – Victor