I have executed a rawQuery in android that returns multiple results that point to different rows.
example: Cursor cursor = db.rawQuery("Select id as _id, List_id, Street_id FROM Streets WHERE Street_id = 5, null);
In my table, this would return two rows:
List_id = 2, Street_id = 5
List_id = 7, Street_id = 5
I then want to update a column named Counter in a separate table for the two rows that List_id 2 and List_id 7 would correspond too (which would be _id = 3 and _id = 8) in my other table.
I understand I will have to do some cursor management.but I would really appreciate it if someone could give me some general basics to get started – I have been struggling on this pretty hard.
BETTER EXAMPLE:
I query my Streets table for all records where my Street_id = 5. I get two results. Within those returned rows, I have a column called List_id. The data in the two List_id columns are 2, and 5. I need to then update a field named Counter my Lists table based on the _id that is equal to 2 and 5.
it looks like all you gotta do is have where clause in your update query also.
that should do the job
EDIT
this will update value in two rows, you can dynamically generate this query depending upon how many row’s previous query returns.
EDIT
ok, let’s try
please explain with example if that’s not what you want or where you are having trouble with
above query will update
Countercolumn inListstable withValuewhere first row’s_id = 2and second row’s_id=5.