Reputation: 2227
I want to create a batch delete and/or update screen for records similar to how the iphone lets you batch delete text messages In other words when you click edit, it shows a checkbox next to all the records and you can then click a button that deletes them or changes a value.
I have discovered following syntax to insert a bunch of rows:
insert into tbl (...) values (...) (...) (...) ...
There also seems to be a way to batch delete using:
delete from tbl where id IN (1,2,3)
Is there a way to do a batch update?
I think I could then just collect an array of the id numbers for the records and run either a delete or update query depending on what button is pushed.
Upvotes: 2
Views: 982
Reputation: 32602
You can use WHERE
condition same like you did for DELETE
query like this:
UPDATE tbl SET col1='...', col2='...' WHERE id IN (1,2,3)
Upvotes: 3