First things first. I only know MS SQL Server. So, its hard to understand some MySQL syntax. Below statement is in MySQL:
INSERT INTO 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 is meaning of ($value>0)
in above statement (line: 5) for following cases:
- $value = 0
- $value = 1
- $value = 10
Thanks in anticipation.