In Android, can I make a SQL query on the cursor?

I can have more than one filter selected in my database, so I would like to query the database for the cursor, and then make a query on this cursor to return another one.

+5
source share
3 answers

You cannot request a cursor. The cursor is the result of a query. This is not a request source. You need to make a new query for the same place where you have the original cursor, with new arguments that define the new dataset that you want.

+4
source

You must use the inner loop to write the filter, this is one option for you

1, 1- 2

1) , db.query() ,

Cursor curTaskList = db.query("tablename", new String[]{"col1", "col2"}, null, null, null, null, null);

2) , db.query() ,

Cursor curTaskList = db.query("timebasedlist", null, "col1 = ? AND col2 = ?", new String[]{"val1", "val2"}, null, null, null);

, ,

+3

?

+1

All Articles