I have to select 3 rows from a table book(id,book_id,status)
with status status=0
.Initially all rows have status
0.So by using a select query.order by id and limit 3 I can select first 3 rows.The question is how can I update the selected rows status to 1 since they are selected.
Am using PHP, CodeIgniter and MySQL, can I do it in a single query?
Example:
id book_id status
1 100 0
2 101 0
3 102 0
4 103 0
5 104 0
6 105 0
After selecting the first 3 rows the that rows's status should be updated to 1
id book_id status
1 100 1
2 101 1
3 102 1
4 103 0
5 104 0
6 105 0