php - Mysql how to combine 2 update queries in 1 -


update `items` set `score`=[value-1],`up_votes`=[value-2],`down_votes`=[value-3] `id` = $id update `items` set `score`=[value-1],`up_votes`=[value-2],`down_votes`=[value-3] `id` = $id 

how can combine these 2 queries when ids needs dynamic? both coming table items.

edit, score ( can + 10 or - 10) upvotes ( can +1 or -1) , downvotes ( can +1 or -1)

so kind of dynamic, sorry misunderstanding

try this, $idlist comma separated list,

update `items` set `score`=[value-1],`up_votes`=[value-2],`down_votes`=[value-3] `id` in ($idlist) 

Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -