mysql - Select rows from database then change a value in a column -


i'm using following query:

select id,link,size files status='-1' order id desc limit 10 

then want change 'status' column values of selected rows -2, possible combine 'select' , 'update' functions in same query don't have query database again?

you not need combine select update: try:

update files set status='-2' status='-1' order id desc limit 10; 

the fields names irrelevant here.


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

Bubble Sort Manually a Linked List in Java -

asp.net mvc - SSO between MVCForum and Umbraco7 -