We have the following table in Mysql using innoDB:
id Var1 Var2 Var 3
1 NULL 1 2
2 2 NULL NULL
3 4 2 NULL
We pretend to produce Var4 with the number of NULL variables per row:
id Var4
1 1
2 2
3 1
I tried unsuccessfully :
update db.table
set var4 = ISNULL(var1) + ISNULL(var2) + ISNULL(var3);
any suggestions?
See Question&Answers more detail:os