Re: COUNTNULL function

2001-08-30 Thread Adams, Bill TQO
SELECT SUM( bool_was_connected=1 ) AS was_connected, SUM( bool_was_connected=0 ) AS was_not_connected, etc... b. [EMAIL PROTECTED] wrote: 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

Re: COUNTNULL function

2001-08-30 Thread kyndig
Thankyou kindly Bill. Just to verify, SUM adds up values. My data is only 1 or 0. I used SUM as an example, the below query you recommend will count all 'rows' which are 0, thus returning a number which represents how many 0's were found? Thankyou for the fast reply, Calvin On Thu, 30 Aug 2001,

RE: COUNTNULL function

2001-08-30 Thread Jay Fesco
Calvin, Maybe I'm just confused (fairly likely), but it appears that you are confusing 'null' with zero. If you actually want to count all values including nulls, COUNT(*) will do it. If you want to count NON nulls, COUNT(a_field_name) does it. SUM(a_field_name) returns the sum of all

Re: COUNTNULL function

2001-08-30 Thread Adams, Bill TQO
Yes. A feature of MySQL is that it returns 1 for true and 0 for false. When you select ... you can put logic tests and sum up the number of true values. In the case of bool_was_connected=0 will have a value of 1 when it is true and then you sum up the results. You could also do something

Re: COUNTNULL function

2001-08-30 Thread kyndig
Evening Jay, I'm still abit new to MySQL. Spending the last 6 months I have worked with it more on my CGI development, than good SQL query practicing. My technical jargon is lacking. In laymens terms ( I know no other at this point in time ) I have a row that has '1' or '0' in it. I'm trying to