📜  获取 sum sqlite android - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:08.294000             🧑  作者: Mango

代码示例1
Cursor cursor = db.rawQuery("SELECT SUM(" + DbHelper.CART_TOTAL + ") as Total FROM " + DbHelper.CART_TABLE, null);

 if (cur.moveToFirst()) {

 int total = cursor.getInt(cursor.getColumnIndex("Total"));// get final total