I want to update a row in any case except an specific field should just be update if another one has some condition.
In this case an example is when i want to update an article. The articles table has 5 columns(id, caption, content, publishdate, published) that published is boolean.
Now i want an specific row to be update in any case but publishdate should be update just if published is true. I want it in one single query.
Is there a way to do such thing ?
edit
I want to check value of published in query, not in database. something like:
UPDATE articles SET (published AS b) = true, publishdate = (b==true? 'new date': b)
you can use
inline IFstatement. egthis assumes that
1 = true, if you store boolean as string thenIF(published = 'true',...UPDATE 1