In my App I am trying to show balance for current month but I can't accomplish that.
This is my code
// Count Current Month Income
public float CurrentMonthIncome(){
float x = 0;
SQLiteDatabase db = getReadableDatabase();
String getamountdata = "SELECT SUM(inc_amount) AS totalInc FROM "+ TABLE_ENTRY + " where year(entry_date)= year(CURDATE()) and MONTH(entry_date)=MONTH(CURDATE())";
Cursor c = db.rawQuery(getamountdata, null);
if(c.moveToFirst()){
x = c.getFloat(0);
}
return x;
}
When I execute that code, I get an exception like
E/SQLiteLog: (1) no such function: CURDATE
Shutting down VM
FATAL EXCEPTION: main
Aucun commentaire:
Enregistrer un commentaire