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