使用连接

时间:2016-01-14 00:08:23

标签: sql oracle join

希望我能从SQL语法中获得一些帮助。我还没有能够自己解决这个问题。我使用了一个语法检查器,它说我的代码很好,但我收到了错误。非常感谢任何帮助!

SELECT DATALIVE.CO_ALLOCATION_TAIL.PO_KEY,
    DATALIVE.CO_ALLOCATION_TAIL.SO_KEY,
    DATALIVE.CO_PICK_LOTS_DETAIL.SO_KEY,
    Sum(DATALIVE.CO_ALLOCATION_TAIL.QTY_ALLOC) AS SumOfQTY_ALLOC,
    Sum(DATALIVE.CO_ALLOCATION_TAIL.PO_ALLOC_QTY) AS SumOfPO_ALLOC_QTY, 
    Sum(DATALIVE.CO_PICK_LOTS_DETAIL.QTY) AS Picked_Qty,
    Min(DATALIVE.CO_ALLOCATION_TAIL.ALLOC_DATE) AS MinOfALLOC_DATE, 
    Max(DATALIVE.CO_ALLOCATION_TAIL.ALLOC_DATE) AS MaxOfALLOC_DATE,
    DATALIVE.CO_SORDER.STATUS
FROM (DATALIVE.CO_ALLOCATION_TAIL
INNER JOIN DATALIVE.CO_SORDER.SO_KEY
    ON DATALIVE.CO_ALLOCATION_TAIL.SO_KEY = DATALIVE.CO_SORDER.SO_KEY)
INNER JOIN DATALIVE.CO_PICK_LOTS_DETAIL
    ON DATALIVE.CO_ALLOCATION_TAIL.SO_KEY = DATALIVE.CO_PICK_LOTS_DETAIL.SO_KEY 
GROUP BY DATALIVE.CO_ALLOCATION_TAIL.PO_KEY,
    DATALIVE.CO_ALLOCATION_TAIL.SO_KEY,
    DATALIVE.CO_SORDER.STATUS,
    DATALIVE.CO_PICK_LOTS_DETAIL.SO_KEY
HAVING (((DATALIVE.CO_SORDER.STATUS) = 'O'))

1 个答案:

答案 0 :(得分:1)

INNER JOIN DATALIVE.CO_SORDER.SO_KEY

这是一个专栏,而不是一个表。需要一张表格,例如DATALIVE.CO_SORDER