lundi 14 mars 2016

Return the total sum of a column in SQLite as double

I'm trying to return the total sum of my column for "prices" in double type.

So far this is how its look like. But I dont know how to use this db.query(); correct, since it has a lot of parameters.

public Cursor totalPrice(){

    SQLiteDatabase db = this.getWritableDatabase();

    Cursor cursorResults = db.query(TABLE_NAME, new String[]{COL_PRICE}, null, null, "sum", null, null );
    return cursorResults;

}

Aucun commentaire:

Enregistrer un commentaire