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
Post a Comment