0
in Java。有沒有人有關如何從這個查詢中檢索數據的想法?我能爲傻笑查詢做到這一點,但我覺得這種情況很混亂:檢索結果集中的結果mysql java
SELECT (SELECT sum(r2.a) FROM R r2 WHERE year(r2.p) =
'2015' and month(r2.p) < month(r1.p)) AS Previous,
(SELECT sum(r3.a) FROM R r3 WHERE year(r3.p)
= '2015' and month(r3.p) > month(r1.p)) AS Next,
(SELECT sum(r4.a) FROM R r4 WHERE year(r4.p)
= '2015' and month(r4.p) = month(r1.p)) AS Curr
FROM R r1
WHERE YEAR(r1.pickupdate) = '2015';
謝謝,你救了我! –
很高興聽到:)請標記正確的答案讓其他人重複使用。 –