开发者

mysql multiple update

开发者 https://www.devze.com 2023-01-21 06:09 出处:网络
basically want to have a multiple update based on a few conditions. So this is my sql query which returns error:

basically want to have a multiple update based on a few conditions. So this is my sql query which returns error:

Table have 3 columns: user_id, week and change

INSERT INTO rank (user_id, week) VALUES (364709193,'201042'),(291179703,'201042'),(394613472,'201042'),(284220417,'201042'),(395465205,'201042'),(394807905,'201042'),(293778748,'201042'),(327814326,'201042'),(370339723,'201042'),(372836496,'201042'),(368162484,'201042'),(304075989,'201042'),(326916014,'201042'),(322410766,'201042'),(395317832,'201042'),(293338707,'201042'),(375562663,'201042'),(325955444,'201042'),(386657944,'201042'),(360475871,'201042'),(299852753,'201042'),(335498887,'201042'),(290629277,'201042'),(376948520,'201042'),(331975235,'201042'),(304878510,'201042'),(284882215,'201042'),(284815942,'201042'),(300048137,'201042')

开发者_运维技巧

ON DUPLICATE KEY UPDATE change='new',change='-4',change='new',change='new',change='new',change='new',change='new',change='new',change='new',change='new',change='new',change='new',change='+1',change='new',change='new',change='new',change='new',change='new',change='new',change='new',change='new',change='new',change='0',change='new',change='new',change='new',change='+18',change='new',change='new' ;

Anyone have any idea? :D


How about:

REPLACE INTO `rank` (`user_id`,`week`,`change`) VALUES (364709193,'201042','new),(291179703,'201042','new'), ... etc.

If this doesn't do what you need, post your error message, or more details about what you are trying to do.

0

精彩评论

暂无评论...
验证码 换一张
取 消