Evening Gurus,

  I have a small problem that I've beaten to death the past 2 days. I am
trying to get the value of a row, and update another table accordingly.
The data within the row is either a 1 or 0.  My issue is in trying to
increment a count for both 1's and 0's.

  In other words, I want to SUM up all the 1's and update a table with
this sum. I also want to sum up all the 0's and add this total count to
the table as well. This can be accomplished in  a long query, or in
through a language..what I am trying to accomplish is to get the total sum
of each value without using a WHERE clause. Something akin to:

    SELECT ...
                 SUM(bool_was_connected),
                 COUNTNULL(bool_was_connected),
    etc...

the SUM will sum up all non-null values. The COUNTNULL would sum up all
rows which have a value of 0.

Does anyone have a UDF for this function? I currently don't have room on
my laptop to download the mysql source code in order to write this up. (
Also have not written a udf for mysql up to this point either)

Thankyou kindly for any reply,
Calvin



---------------------------------------------------------------------
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

Reply via email to