Can some help me with this sql statement which i want to insert into a function node, i would like also to use variables inplace 1 @ State and LRoom1 @ Device, but not yet.
msg.topic="UPDATE MultiSenser SET State = 1 WHERE Device = LRoom1";
return msg;
If using a Change node then I don't think you should have the double quotes round the outside. The fact that the type is selected as a/z means that it knows it is a string. I don't think the mysql node needs the ; on the end of the statement, it will add that for you.
Thanks for reply, i would of never thought of using Change node, but the statement to insert is
UPDATE MultiSenser SET State = 1 WHERE Device = "LRoom1"
Thanks very much, but i cant use variables with a change node.
A tip I was given, which works really well for me, is to use the 'template' node (located in the function category) as it makes constructing the MySQL query fairly easy. Here's a very simple example.
If you need to run the same update statement lots of times with different variables, have a look at SQL prepared statements as they are a lot more efficient.