1. 程式人生 > >使用sql concat拼接更新語句

使用sql concat拼接更新語句

更新 upd lec ada mobile real sele 語句 dad

例子:

select a.id,concat(‘update sljr_jrxj.loan_borrow set status=3,fadada_status=0 where borrow_user_id=‘,a.id,‘ and borrow_nid=‘‘‘,borrow_nid,‘‘‘;‘)
from sljr_jrxj.user a
inner join sljr_jrxj.loan_borrow b on a.id=b.borrow_user_id
inner join sljr_jrxj.real_user c on a.id=c.user_id
where
b.`status`=0 and b.fadada_status=0 and
b.order_source=‘39‘ and
a.mobile in
(
‘18993037575‘)

使用sql concat拼接更新語句