¿Cómo puedo tomar la suma de la columna y mostrarla en ListView?

I want to take sum of a specific database column (the amount column) where the area equals a user defined area. How could I get this?

Yo he tratado:

 cursor=db.rawquery("SELECT sum(amt) as Sum FROM mytable WHERE area LIKE ?", null);

Now I want to show this result in ListView. How do I display it and is the above syntax correct?

preguntado el 08 de noviembre de 11 a las 10:11

sum(amt) returns only one value!! and still want to display inside the ListView? -

From what I read on your post, your rawQuery is summing up ALL rows' amount column, hence the single value returned. Did you use GROUP BY? -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.