Note that there are some explanatory texts on larger screens.

plurals
  1. POi need to SUM column values for the curren month only
    primarykey
    data
    text
    <p>Hi everyone i need to get a SUM query to sum only the values from the current month</p> <p>is there anyway to do that? </p> <pre><code>public int getTotal() { // TODO Auto-generated method stub int sum=0; Cursor cursor = ourDatabase.rawQuery( "SELECT SUM(_value) FROM TableActone", null); cursor.moveToFirst(); if(cursor.getCount()&gt;0) { sum=cursor.getInt(0); } return sum; } </code></pre> <p>I have this right now, but it gets the SUM of every value on that column !</p> <p>I want just to sum up the value for november 2013 for instance.</p> <p>Anyway to do that?</p> <p>TY all in advance</p> <p>Edit:</p> <pre><code>public static final String KEY_DATEACTONE = "_date"; </code></pre> <p>i have a column where the users inputs the date of the expense. (Its a expense manager app) </p> <p>The user inputs the date of the expense and i use this method to get the date into de database</p> <pre><code>final DatePickerDialog.OnDateSetListener mydate = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { // TODO Auto-generated method stub myCalendar.set(Calendar.YEAR, year); myCalendar.set(Calendar.MONTH, monthOfYear); myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); updateLabel(); } }; date.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub new DatePickerDialog(ActoneSQLentry.this, mydate, myCalendar .get(Calendar.YEAR), myCalendar.get(Calendar.MONTH), myCalendar.get(Calendar.DAY_OF_MONTH)).show(); } }); } private void updateLabel() { String myFormat = "dd/MM/yy"; // In which you need put here SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.US); date.setText(sdf.format(myCalendar.getTime())); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload