03-26-2019 05:46 AM
Hello,
always when my table has more than one column my query return an "Object 0x000000 is not valid." error.
I have tested the query in the MySQL workbench and it works, also when the table has more than 1 column..
The query: update mytable set mytable.row5 = (select row1+row2+row3+row4);
Why the query works for a table with 1 column, but not for a table with x columns?
Thanks in advance!
Best regards,
Stefan
03-26-2019 12:21 PM
Give an example of data before and after the query to show what you want. You can't select row1 + row2 like you are doing unless your columns are named row1, row2 (which makes no sense).
Your query should be:
UPDATE mytable SET row5 = row1 + row2 + row3 + row4 WHERE condition
03-27-2019 02:30 AM
"The WHERE
clause is optional. If you omit the WHERE
clause, the UPDATE
statement will update all rows in the table."
That is what I want, it works when I try the query in the mysql command line.
With the labview db query execute query it works only for a table with 1 column but not for tables with more than 1 columns.
I also tried a mysql procedure with a while loop with the same result.
03-27-2019 06:26 AM
Yes the WHERE clause is optional. Did you use my query without the WHERE clause? Mine is different than yours in that you have an additional SELECT that doesn’t make sense. Show us the exact query that you are using.