This is a discussion on conditionally set in update query within the MySQL forums, part of the Database Server Software category; --> Hallo, i want to update a datetime field conditionally. something like: update actions set finalDate = if (finalDate <> ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hallo, i want to update a datetime field conditionally. something like: update actions set finalDate = if (finalDate <> '0000-00-00 00:00:00',now(),'0000-00-00 00:00:00') where actionsId = '20'; It didn't do what I want. Is there another way to conditionally do this or should I use an extra query to see what the value og finalDate is? Thanxs!! |
| ||||
| Tonight it came to me that it should be possible to do it like this: update actions set finalDate = now() where actionsId = '20' AND finalDate = '0000-00-00 00:00:00') Sorry "Sjef" <manuals-scripts@planet.nl> schreef in bericht news:468e4a7c$0$25492$ba620dc5@text.nova.planet.nl ... > Hallo, > i want to update a datetime field conditionally. something like: > > update actions set finalDate = if (finalDate <> '0000-00-00 > 00:00:00',now(),'0000-00-00 00:00:00') where actionsId = '20'; > > It didn't do what I want. Is there another way to conditionally do this or > should I use an extra query to see what the value og finalDate is? > > Thanxs!! > |