Ok, I've tried that but it gave me an error.

I have a more complex query that use more tables, and I need to specify
something like:

count(table_name.*)
... but here MySQL tells me that there is an error near this expression, so
I need to use instead:
count(table_name.a_column_name)

I would like to use:

count(table_name.*) ... group by a_column_name
... but this won't work because this query not only that will give me that
error, but I want to take the distinct values of the a_column_name only for
non null values, and for null values I want to count them all thinking that
they are different values.
In fact, the null values should be considered different values when using
"distinct".

Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]

----- Original Message -----
From: "Paul DuBois" <[EMAIL PROTECTED]>
To: "Octavian Rasnita" <[EMAIL PROTECTED]>; "Daniel Kiss" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, February 12, 2003 7:09 PM
Subject: Re: Counting null values


At 9:41 +0200 2/12/03, Octavian Rasnita wrote:
>It won't work because MySQL doesn't count null values.

It depends.

count(FieldName) will not count NULL values
count(*) will, because it counts rows, not values.

>
>Teddy,
>Teddy's Center: http://teddy.fcc.ro/
>Email: [EMAIL PROTECTED]
>
>----- Original Message -----
>From: "Daniel Kiss" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Tuesday, February 11, 2003 8:18 AM
>Subject: Re: Counting null values
>
>
>Hi Octavian,
>
>Try this:
>
>select FieldName, count(*) from TableName group by FieldName
>
>Bye,
>          Danny
>
>At 16:39 2003.02.08._+0200, you wrote:
>>Hi all,
>>
>>I have a table where I have something like this:
>>
>>| abc |
>>| abc |
>>| xxx |
>>| null |
>>| null |
>>| null |
>>
>>I want to count these lines to give the result 5, meaning a distinct count
>>for values which are not null, and counting all the null values.
>>
>>This means 1 for "abc", one for "xxx", and 3 for null values.
>>
>>Can you tell me what sql query should I use for counting this?
>>
>>Thank you.
>>
>>
>>Teddy,
>>Teddy's Center: http://teddy.fcc.ro/
>  >Email: [EMAIL PROTECTED]





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