473,498 Members | 2,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Count zeros

SELECT DISTINCT Ap2.test1, Count(Ap2.test1) AS AantalVantest1
FROM Ap2
GROUP BY Ap2.test1;

gives me a record count per unique value of test1 field. How do I include
the count of all the records without a value? The table resulting from the
query just shows an empty value with 0 as the count which is not correct.

thanks,
john
Jul 26 '06 #1
3 1964
"john" <jo**@test.comwrote in
news:xt********************@casema.nl:
SELECT DISTINCT Ap2.test1, Count(Ap2.test1) AS AantalVantest1
FROM Ap2
GROUP BY Ap2.test1;

gives me a record count per unique value of test1 field. How
do I include the count of all the records without a value? The
table resulting from the query just shows an empty value with
0 as the count which is not correct.

thanks,
john
Your problem is that instances of ap2.test1 are null, which access
properly refuses to count. Change the count() to count something
which is not null. Use count("X") AS AantalVantest1 instead.
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jul 27 '06 #2
I don't really understand how... but it works ;-)
Thanks,
john

"Bob Quintal" <rq******@sPAmpatico.caschreef in bericht
news:Xn**********************@66.150.105.47...
"john" <jo**@test.comwrote in
news:xt********************@casema.nl:
>SELECT DISTINCT Ap2.test1, Count(Ap2.test1) AS AantalVantest1
FROM Ap2
GROUP BY Ap2.test1;

gives me a record count per unique value of test1 field. How
do I include the count of all the records without a value? The
table resulting from the query just shows an empty value with
0 as the count which is not correct.

thanks,
john
Your problem is that instances of ap2.test1 are null, which access
properly refuses to count. Change the count() to count something
which is not null. Use count("X") AS AantalVantest1 instead.
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jul 27 '06 #3
"john" <jo**@test.comwrote in
news:Cd********************@casema.nl:
I don't really understand how... but it works ;-)
Thanks,
john
Allen Browne, who is a regular responder here, has some pretty
good information on nulls

The Query Lost My Records! (Nulls)
http://allenbrowne.com/casu-02.html

Common errors with Null
http://allenbrowne.com/casu-11.html
http://allenbrowne.com/casu-12.html
his whole tips page is worth bookmarking.
http://allenbrowne.com/tips.html

"Bob Quintal" <rq******@sPAmpatico.caschreef in bericht
news:Xn**********************@66.150.105.47...
>"john" <jo**@test.comwrote in
news:xt********************@casema.nl:
>>SELECT DISTINCT Ap2.test1, Count(Ap2.test1) AS
AantalVantest1 FROM Ap2
GROUP BY Ap2.test1;

gives me a record count per unique value of test1 field. How
do I include the count of all the records without a value?
The table resulting from the query just shows an empty value
with 0 as the count which is not correct.

thanks,
john
Your problem is that instances of ap2.test1 are null, which
access properly refuses to count. Change the count() to count
something which is not null. Use count("X") AS AantalVantest1
instead.
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com




--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jul 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6525
by: John Furphy | last post by:
Could someone assist with getting the count function working correctly in this example please. I know the count function will return all rows that do not have null values, but in this case I want...
5
11479
by: samik_tanik | last post by:
I need to export a datagrid to Excel. I could did this. But, also need to keep the leading zeros in the data. How can I acheive this? Any help would be appreciated. -- Thanking you in...
2
1576
by: Teep | last post by:
I have a simple text box called txtrefnum, if the user enters a number length less than 9 characters long than I need to have lead zeros added to it. Does anyone know how to do this? I couldn't...
6
1406
by: TN Bella | last post by:
I have a simple text box called txtrefnum, if the user enters a number length less than 9 characters long than I need to have lead zeros added to it. Does anyone know how to do this? I couldn't...
2
1731
by: ineedahelp | last post by:
I have some code that counts the number of times that 0 (zero) is entered in a table. I want to save this to a variable and print it out in a msgbox. What I get as the variable is a repeat of the...
29
1920
by: n00m | last post by:
http://www.spoj.pl/problems/SUMFOUR/ 3 0 0 0 0 0 0 0 0 -1 -1 1 1 Answer for this input data is 33. My solution for the problem is...
21
11254
by: dadimar | last post by:
I'm trying to write a program that reads unspecified number of positive and negative values, counts them and computes the average of the input values, not counting zeros. The program should end with...
6
7732
by: JimmyKoolPantz | last post by:
Task: Customer wants a script of the data that was processed in a "CSV" file. Problem: Zip-Code leading zeros are dropped Basically we have a client that has requested a custom script for...
3
9911
by: ManuelValdez | last post by:
Hello everybody! I need your valuable help to get an Excel macro to delete the single zeros only and no the zeros containing numbers like 360, 90, etc., because if I chose the search and replace...
0
6993
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6881
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5456
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4899
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4584
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1411
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.