mercredi 22 avril 2015

Why does using SUM(mycolumn) suddenly make mycolumn non-existent

I get an IllegalArgumentException when I try to use the aggregate function SUM() in my query which otherwise works fine without it.

Without using SUM() my colPayDue is referenced properly and I get the proper results but the moment I try to integrate a SUM() in the query it suddenly can't be found. I'm obviously doing something wrong but what?

Can someone tell me what I'm doing wrong ?

    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);

Aucun commentaire:

Enregistrer un commentaire