0
我具有以下用的Apache Derby問題問題(與子查詢和內部連接):Apache Derby的分組或總誤差:
SELECT * FROM (SELECT ID,ENTRYDATE,CAST((SUM(DRUGAMOUNT_ML)) AS DECIMAL(15,2)) AS SUM_DRUGAMOUNT_ML FROM PORPHYRIE GROUP BY ENTRYDATE) a
INNER JOIN PORPHYRIE b
ON a.ID=b.ID
;
表PORPHYRIE看起來像:
ID EntryDate DRUGAMOUNT_ML DRUGAMOUNT_MG ....
6601 2014-11-15 0.25 ...
6602 2014-11-15 0.26 ...
.
.
.
該錯誤消息是:
Column reference 'PORPHYRIE.ID' is invalid. For a SELECT list with a GROUP BY, the list may only contain grouping columns and valid aggregate expressions.
我不明白是什麼問題....請幫助!