Link to home
Start Free TrialLog in
Avatar of minotaur01
minotaur01

asked on

MySQL conditional field update

I trying to create an update statement that update a single field in two different ways.

Here is what i have so far:
UPDATE service_surveys SET notes = IF(notes IS NULL, CONCAT(notes, ?nts), CONCAT(notes, '\n', ?nts)) WHERE id =  {An ID}

The statement executes without throwing any errors but the field dose't update. Basically i trying to add string data to the existing string data and add a newline between the two strings only if there is already a string data present.

I'm using ASP.net with the MySQL Connector and a parameter for passing the data.


ASKER CERTIFIED SOLUTION
Avatar of NovaDenizen
NovaDenizen

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of minotaur01
minotaur01

ASKER

Thanks, that fixed the problem i total wasn't thinking when i put in the CONCAT for the 'true' condition, it didn't need to concat there is nothing the.