我有两张桌子CompList表,其中包含以下列:CompId,McID,station,slot,subslot以及其他几个BookingTable,其列为:CompId,LineID,McID,station,slot,subslot。我想得到以下结果:仅在该CompList.CompId == BookingTable.CompId的行(两个表中都只有CompId)我需要从CompList:CompId,McID,station,slot,subslot和BookingTable的结果列中:LineID,McID,station,,slot我如何区分结果表中具有相同表的相同列和结果表中的相同列?感谢帮助。 (adsbygoogle = window.adsbygoogle || []).push({}); 最佳答案 使用别名:SELECT CL.CompId, CL.McID, CL.station, CL.slot, CL.subslot, BT.LineID, BT.McID as BookingMcId, BT.station as BookingStation, BT.slot as BookingSlot, BT.subslot as BookingSubslotFROM CompList as CLJOIN BookingTable as BT ON BT.CompId = CL.CompId (adsbygoogle = window.adsbygoogle || []).push({});
09-25 23:26