Re: Examples of SQL anomalies?

From: -CELKO- <jcelko212_at_earthlink.net>
Date: Fri, 27 Jun 2008 11:29:31 -0700 (PDT)
Message-ID: <5e7be9c6-e60a-42ce-8d16-49184a4e51b3@f63g2000hsf.googlegroups.com>


>> I do not use nulls in my tables. I still get null when I sum what turns out to be zero rows. If I want the total amount charged on invoices for a client in a certain date range, and there are no such invoices, the total is zero. <<

No, that is flat wrong. There is no such invoice, so the question of its total makes no sense. It is a totally different kind of thing from an invoice that actually totaled to zero. Zero, empty set, empty strings, NULLs, etc. are all different concepts around the idea of missing data of some kind.

Also, why are you using cursors? If you want to give this misleading data, then use a COALESCE(invoice_tot, 0.00) in your code. Received on Fri Jun 27 2008 - 13:29:31 CDT

Original text of this message