0
如何在第3級子查詢中使用頂級SELECT
中的列?在第3級子查詢中使用列
我試過,但它給出了:unknown column foo.id
SELECT foo.id,
(
SELECT SUM(bar.amount)
FROM bar
JOIN (
SELECT DISTINCT ding.id
FROM baz
JOIN ding ON ding.baz_id = baz.id
WHERE baz.foo_id = foo.id
) AS j ON j.id = bar.id
) AS amount
FROM foo
試量之後,除去逗號。 –