-1
我想在FROM塊中通過Doctrine 2.3 DQL使用子查詢。學說2 DQL子查詢
每次IM以下錯誤
[Semantical Error] line 0, col 839 near '(SELECT ': Error: Class '(' is not defined.
這是我目前DQL代碼
$query = $this->getEntityManager()->createQuery('
SELECT
taS2.netDueDate,
SUM(taS2.amountInThousands) AS SumAmountInThousands,
SUM(taS2.netDAO1) AS SumnetDAO1,
SUM(taS2.netDAO2) AS SumnetDAO2,
SUM(taS2.netDAO3) AS SumnetDAO3,
SUM(taS2.netDAO4) AS SumnetDAO4,
SUM(taS2.netDueDate * taS2.amountInThousands) AS SumNetDueDateInThousands,
SUM(taS2.critical)
FROM
(SELECT
ta.id,
ta.documentDate,
SUBSTRING(CONCAT(ta.netDueDate, \'\'), 9, 2) AS netDueDate,
ta.discountRate,
ta.amountInThousands,
ta.netDAO1,
ta.netDAO2,
ta.netDAO3,
ta.netDAO4,
ta.netDueDate,
1 AS counter,
CASE
WHEN (ta.clearingDate > ta.netDueDate) AND
SUBSTRING(CONCAT(ta.clearingDate, \'\'), 6, 2) <> SUBSTRING(CONCAT(ta.netDueDate, \'\'), 6, 2)
THEN ta.amountInThousands ELSE 0
END AS critical
FROM
AcmeBundle:Transaction ta
WHERE
ta.discountRate = 0) taS2
GROUP BY taS2.netDueDate
ORDER BY SUM(taS2.amountInThousands) DESC;
);
大家有一個想法,我怎麼做到這一點正常運行這一點,得到些什麼?
感謝。這個鏈接轉到Doctrine 1 Documentation,即時通訊原則2.3。 – darthsoup
你的權利,對不起。如果可能,您仍然應該使用* native * SQL查詢。 – ferdynator