Update row with 3 column that one of them have previous value?

hi i have reserve table with 4 column,one of them id,

i wana update 3 other column,but when one of this query is like before query dont work!!!

may be each of this 3 column have previous value to update this row,see below example:

if one row values is like this:{id=1,breakfastid=3,lunchid=4,dinnerid=1},

this query works:UPDATE reserve SET breakfastid=1,lunchid=3,dinnerid=2 WHERE id=1
this query dont work return empty :UPDATE reserve SET breakfastid=3,lunchid=3,dinnerid=2 WHERE id=1

i know its because breakfastid value is like previous value,but i wana other columns (lunchid and dinnerid)update,

how to handle this in situations like this ?

i mean Update row based on match to previous row

There must be more going on that what you’ve shown.

AFAIK you should be able to SET to just about anything regardless if the field already has that value
there is a constraint involved
there is a problem with the code doing the query

1 Like

i did thi with some php,i insert each value in separate query,if query fail with same previous value,other columns will insert,its not optimized but my only way

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.