can someone tell me what is the correct syntax to do an update in Node-red , im using mysql node for database.
this is the one I used but it's wrong :
msg.topic = "UPDATE cambio SET cambio_1 = ("msg.payload.cambio_1")";
return msg;
SQL syntax normally doesn't use brackets round the value. So your function node should probably look something like this:
msg.topic = "UPDATE cambio SET cambio_1 = " + msg.payload;
return msg;
This does assumes that msg.payload
is a number. If it is a string then you would need to include quotes around the value:
msg.topic = "UPDATE cambio SET cambio_1 = '" + msg.payload + "'";
return msg;