0
我有以下查詢,它工作正常。Oracle SQL內部連接
SELECT c.id, c.customer_name, b.batch_prefix, b.BatchCount, b.InvoiceCount, e.time_of_delivery, e.time_of_delivery_mail, e.time_of_delivery_clock
FROM koll_customers c
INNER JOIN (
SELECT batch_prefix, COUNT(*) AS BatchCount,
SUM (batch_counter) AS InvoiceCount
FROM koll_batchlogs
WHERE
exists_db = 0
and is_checked = 1
and batch_counter > 0
and trunc(created_date) > trunc(sysdate-7)
GROUP BY batch_prefix) b
ON b.batch_prefix=c.customer_prefix
INNER JOIN koll_customer_export e
ON c.id = e.id
但是,當我添加另一個JOIN(最後一個加入)與SELECT和WHERE提示錯誤: 「無效的標識符」
SELECT c.id, c.customer_name, b.batch_prefix, b.BatchCount, b.InvoiceCount
FROM koll_customers c
INNER JOIN (
SELECT batch_prefix, COUNT(*) AS BatchCount,
SUM (batch_counter) AS InvoiceCount
FROM koll_batchlogs
WHERE
exists_db = 0
and is_checked = 1
and batch_counter > 0
and trunc(created_date) > trunc(sysdate-7)
GROUP BY batch_prefix) b
ON b.batch_prefix=c.customer_prefix
INNER JOIN (
SELECT time_of_delivery
FROM koll_customer_export
WHERE time_of_delivery=2) e
ON e.id = c.id
我不知道,什麼是與最後一個問題加入?
完美:-)謝謝。我把它標記爲在時間限制結束時解決。 – 2014-12-06 17:55:03