multiple updation using single mysql query
I need to update multiple rows with different values.Is it possible to do in mysql? ie,some thing like this
UPDATE landing_page SET (rotation_slot开发者_JAVA技巧_begin='0',rotation_slot_end='0.333333333333' where landing_pageid=265),(rotation_slot_begin='0.333333333333',rotation_slot_end='0.666666666667' where landing_pageid=267),(rotation_slot_begin='0.666666666667',rotation_slot_end='1' where landing_pageid=268)
but this query is not working.I think something like this.Anybody can help me please
Here is the solution I have already posted before.
An UPDATE query can only have one WHERE clause so you can't update multiple rows in that way.
See documentation.
You could use cases for this. Take a look at this thread for an example.
Personally, I would create and execute 3 seperate queries in this case.
精彩评论