我正在尝试在oracle sql中加入两个表,但我似乎无法让它工作。下面的sql是我到目前为止所拥有的。 Cartype在车辆表中,价格在购买表中。他们共同的关键是ID。有人能告诉我什么是错的,并提供可能的解决办法吗?
SELECT cartype, price
FROM VEHICLE547896
INNER JOIN PURCHASE547896
ON ID = ID
顺便说一下,我之前已经问过这个问题,但我仍然感到困惑。
答案 0 :(得分:1)
SELECT cartype, price
FROM VEHICLE547896 a
INNER JOIN PURCHASE547896 b
ON a.ID = b.ID
答案 1 :(得分:1)
您需要更好地了解表关系。
在ID
保存到VEHICLE547896
表时,验证PURCHASE547896
中的VehicleID
的等效内容。
是Vehicle_ID
吗? ID
?或类似的东西。因为PURCHASE547896
中的ID
肯定是购买的SELECT cartype, price
FROM VEHICLE547896 AS v
INNER JOIN PURCHASE547896 AS p
ON v.ID = p.VehicleID
,而不是车辆。
func operationQueueWithBlockandCancel(){
let mainQueue = OperationQueue.main
let operationBlock1 = BlockOperation()
let operationBlock2 = BlockOperation()
let operationBlock3 = BlockOperation()
operationBlock1.addExecutionBlock {
//Any task
}
operationBlock2.addExecutionBlock {
//Any task
}
operationBlock3.addExecutionBlock {
//Any task
}
//Add dependency as required
operationBlock3.addDependency(operationBlock2)
operationBlock2.addDependency(operationBlock1)
opQueue.addOperations([operationBlock2,operationBlock1,operationBlock3,], waitUntilFinished: false)
}
答案 2 :(得分:0)
如果你有同名的列,那么你还需要在它之前命名表
SELECT VEHICLE547896.cartype, PURCHASE547896.price
FROM VEHICLE547896
INNER JOIN PURCHASE547896 ON PURCHASE547896.ID = VEHICLE547896.ID