當我嘗試在我的查詢中使用聚合函數SUM()
時,我得到IllegalArgumentException
,否則在沒有它的情況下工作正常。爲什麼使用SUM(mycolumn)突然使mycolumn不存在
沒有使用SUM()
我的colPayDue
被正確引用,我得到了正確的結果,但是當我嘗試將SUM()
集成到查詢中時,它突然找不到。我顯然做錯了,但是什麼?
誰能告訴我什麼,我做錯了什麼?
Cursor cur = db.rawQuery("SELECT " + " _id, " + colCompClass + "," + colName + ", SUM(" + colPayDue + ")," + colDateDue + " FROM " + viewComps + " WHERE " + colDateDue + "=" + "(SELECT MIN (" + colDateDue + ") FROM " + viewComps + " WHERE " + colDateDue + ">=?)" + " GROUP BY " + colDateDue + "," + colCompClass, params);
變化'SUM( 「+ colPayDue + 」)''到SUM(「 + colPayDue +」)作爲colPayDue' –