Home > database >  Update the b table with a mysql table data
Update the b table with a mysql table data

Time:09-30

There are two table
Table a
Chejia chudeng
LBERCACB7DX4 '2013-08-27 00:00:00'
LSVFK46R5D2 '2013-10-16 00:00:00'
LSVFK46R5D2 null
LZWACAGA7A '2010-09-02 00:00:00'
LLV2A2A196 null
LVGBE40K7A '2011-03-24 00:00:00'
LSGSA52S2CY '2012-01-09 00:00:00'
LJDLAA296CO '2012-09-20 00:00:00'
LGBG22E09 null
LGBG22E099 '2009-11-28 00:00:00'
Table b
Chejia riqi
LBERCACB7DX4 '2013-08-27 00:00:00'
LSVFK46R5D2 '2013-10-16 00:00:00'
LSVFK46R5D2 '2013-10-16 00:00:00'
LZWACAGA7A '2010-09-02 00:00:00'
LLV2A2A196 '2007-04-05 00:00:00'
LVGBE40K7A '2011-03-24 00:00:00'
LSGSA52S2CY '2012-01-09 00:00:00'
LJDLAA296CO '2012-09-20 00:00:00'
LGBG22E09 '2009-11-28 00:00:00'
LGBG22E099 '2009-11-28 00:00:00'
Table B in the same field as the table a chejia, riqi,
Want to use the date update B into A same chejia riqi, but part of the update only null, not null part not update,

CodePudding user response:

A, b
 update set a.r iqi=b.r iqi where a.c hejia=biggest hejia and a.r iqi s null 

CodePudding user response:

Update a, b set a.r iqi=b.r iqi where a.c hejia=biggest henjia and a.r iqi is null
  • Related