I have a database, with names and true or false values. I have for example 10 rows and four of them have got the value "true".
name | value
-------------
1 | false
2 | true
3 | false
4 | true
5 | false
6 | false
7 | true
8 | false
9 | false
10 | true
my try is:
val c = db!!.rawQuery("SELECT COUNT(*) FROM table GROUP BY value HAVING value = \"true\"", arrayOf())
c.moveToNext()
Log.e("OUTPUT", c.toString())
but the log I will get is:
E/OUTPUT: android.database.sqlite.SQLiteCursor@b0b20ea
So my question is, how to get the countnumber as a usable Integer value?
truelines you should simply use:SELECT COUNT(*) FROM table WHERE value = "true";. If it doesn't work, tryvalue IS true.