Meaning of ">" in MySQL update statement -
first things first. know ms sql server. so, hard understand mysql syntax. below statement in mysql:
insert stats_by_variantstats(variant_id, count, nonzero, sum, avg, sumsq, wavg) values(5, 1, 0, 0, 0, 0, 0) on duplicate key update count = count + $count, nonzero = nonzero + ($value>0), sum = sum + $value, avg = sum / (count + 1), sumsq = sumsq + ($value * $value), wavg = 0.9 * wavg + 0.1 * $value
what meaning of ($value>0)
in above statement (line: 5) following cases:
- $value = 0
- $value = 1
- $value = 10
thanks in anticipation.
this boolean expression. meaning identical conditional expression:
case when $value>0 1 else 0 end
in case of update
, nonzero
column incremented each time $value
positive.
Comments
Post a Comment