* Przemyslaw Popielarski > I've got query like this: > > "select count(ID) from TABLE where (TABLE.A + TABLE.B + TABLE.C + > TABLE.D) > 0" > > A,B,C,D are decimal values. > > There are over 10000 records where A is greater than 0, > about 1000 where B is greater than 0, > about 500 where C is greater than 0, > and about 300 where D is greater 0. > > I want to get a value of at least 10000 of course. > But I get a very small value, near 50. > > The problem is, I think, with NULL columns. Often B,C and D don't have > decimal value, but NULL. > I thought, that this should be counted like zero. Am I wrong ?
NULL is not the same as zero. If any of the field values are NULL, the result of the expression is NULL. -- Roger query --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php