mysql - SELECT & UPDATE according to status in one sql -


i wondering how this:

at moment have this, can see selecting status 0 & 2, later in code updating status 0 97 , status 2 99

select id_queue, status table status in (0,2) order status, id_queue asc update;  update table set status = 97 id_queue= " + id_sms + ";  update table set status = 99 id_queue= " + id_sms + "; 

i want select & update, , row ids of id_queue later use can help?

much appreciated.

update table set status = case status when 0 97                          when 2 98              end status in (0, 2) 

if want save id_queue values, you'll either need create temp table, or store them in program outside database. i'd second reasonably sized set - lot less housekeeping if can keep them in scope in program.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -