mysql 子查询 根据查询结果更新表

1 UPDATE 
2 key_info k1,
3 (SELECT nid,nick FROM key_info  WHERE adddate=CURRENT_DATE-1 and isTmall=4)k2 
4 SET k1.nick=k2.nick 
5 WHERE k1.nid = k2.nid AND k1.adddate=CURRENT_DATE

 

posted @ 2016-11-27 22:21  恰似少年  阅读(11271)  评论(0编辑  收藏  举报