I have a property table where it updates from an XML feed regulary. If the property is not in the database it inserts; if it is there it updates it. But also users can update the fields via a form on the back end of the website. If a user updates a field, it flags it up and changes the status to 1.
My table looks like this:
heading | nice house
up_heading | 1
price | 40000
up_price | 0
In this case, when daily cron job runs the update, it will not update the heading as the up_heading
's status is 1, but it will update the price as the status of up_price
is 0.
So my question is, how can I write an efficient update query like:
update property
set heading = $heading
case up_heading = 0, set price = $price
case up_price = 0,
and so on till where p_id = %p_id
?