At 21:38 -0500 11/20/02, Daniel Chicayban wrote:
Query:
SELECT Count(id) AS Taken FROM ClassGuests WHERE id=5
Returns 1 record, value 0
Query:
SELECT Sum(nGuests) AS Taken FROM ClassGuests WHERE id=5
Returns 1 record, value '' (nothing)
And
Query:
SELECT Count(id)+Sum(nGuests) AS Taken FROM ClassGuests WHERE id=5
Returns 1 record, value '' (nothing)
I expected to be 0, but it's not. And because of that I need to
convert this through code. Is that anyway to force Sum() to return 0
if nothing found?
Thanks.
Daniel
My quess is that you're issuing these queries through some API?
If so, you're probably not getting '' back, but NULL. And if
*that's* so, you can detect that by checking for whatever value
your API uses to represent NULL.
---------------------------------------------------------------------
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