insert - mysql copy data to another table and mark as transfered -


i want transfer data table tb table ta entered before today , mark copied ones "copied" in ta by. whole thing has happen routine. actual code is

begin  insert      `ta` (         `a`,         `b`,         `c`,     )  select      `a`,     `b`,     `somedate`      `tb`      `somedate`<now()          update      `tb` set `status`='copied'      `somedate`<now();  end 

so have 2 "queries" (is named correct? - quite new mysql). there more elegant way to this? maybe 1 bulletproof in sense "nothing can happen" between 2 statements? in advance.


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -