hangkk2008

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

1.关联删除

删除表t1已经在表t2中存在的数据:

DELETE t1 FROM table_1 t1, table_2 t2
WHERE t1.id=t2.id and t1.year=t2.year and t1.month=t2.month;

2.关联更新

update xcs_user_credit_score a1,xcs_user_credit_score a2
   set a1.user_currday_score=a1.user_currday_increment_score+a2.user_currday_score
 where a1.pt_day='2017-09-20' and a2.pt_day='2017-09-19'
   and a1.uid=a2.uid;

 

posted on 2021-03-05 11:59  鱼儿也疯狂  阅读(83)  评论(0)    收藏  举报