使用php mysql更新另一列,将行移动到另一个表

How move rows from table like this example "Table_A"

no uid code name  date
1  001 abc  test1 2016-01-01
2  001 ccc  test2 2016-01-02
3  001 bbb  test3 2016-01-03

To "Table_B"

no uid code name  status date
1  001 abc  test1 w      2016-01-01
2  001 ccc  test2 w      2016-01-02
3  001 bbb  test3 w      2016-01-03

and move by uid where uid = '001'

where diferent is in table_b is with status. so when the row move and status autometicly set record to "w"

You would simply do something like the following:

INSERT INTO Table_B (`no`, `uid`, `code`, `name`, `status`, `date`) 
SELECT `no`, `uid`, `code`, `name`, 'w', `date` FROM Table_A

As you can see, 'w' is just set by adding a value to the select. To move by a single uid, just limit the select.

INSERT INTO Table_B (`no`, `uid`, `code`, `name`, `status`, `date`) 
SELECT `no`, `uid`, `code`, `name`, 'w', `date` FROM Table_A WHERE uid = '001'