mysql数据库 有数据则更新,没有就插入

mysql

数据有则更新,没有就插入

s q l = ′ i n s e r t i n t o ‘ s s u s e r m o n e y ‘ ( ‘ u i d ‘ , ‘ c o i n b a l a n c e ‘ , ‘ c o i n s p e n d t o t a l ‘ ) v a l u e s ( ′ . sql = 'insert into `ss_user_money` (`uid`, `coin_balance`, `coin_spend_total`) values ('. sql=insertintossusermoney(uid,coinbalance,coinspendtotal)values(.value[‘id’].’,’. v a l u e [ ′ c o i n b a l a n c e ′ ] . ′ , ′ . value['coinbalance'].','. value[coinbalance].,.value[‘spendcoin’].’) ON DUPLICATE KEY UPDATE coin_balance = coin_balance +’. $value[‘coinbalance’].’, coin_spend_total = coin_spend_total+'. $value[‘spendcoin’];

,2,批量更新
UPDATE ss_member SET coinbalance = CASE id when 10985 then coinbalance+100 end

你可能感兴趣的:(mysql)