mysql - "null" in mathematical calculations? -


i'm trying make mysql query returns rows (col_a+col_b-col_c+col_d) != col_e, of columns decimal , default null. there 1 row know of meets these requirements, when ran query above logic where clause, row didn't show up. noticed col_c null, instead of numerical value, , after changing 0 row showed when ran query.

why did happen? have assumed null interpreted 0 in instance such above?

null (as far interpretation goes) unrepresentable data. appropriate tests null is null, is not null, , several functions made handle null values: http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html

you - ifnull(col_c, 0)+col_d (coalesce work identically in case).

more information on working nulls: http://dev.mysql.com/doc/refman/5.0/en/problems-with-null.html


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -