473,795 Members | 3,048 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 1986
"john" <jo**@test.comw rote in
news:xt******** ************@ca sema.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******@sPAmp atico.caschreef in bericht
news:Xn******** **************@ 66.150.105.47.. .
"john" <jo**@test.comw rote in
news:xt******** ************@ca sema.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.comw rote in
news:Cd******** ************@ca sema.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******@sPAmp atico.caschreef in bericht
news:Xn******** **************@ 66.150.105.47.. .
>"john" <jo**@test.comw rote in
news:xt******* *************@c asema.nl:
>>SELECT DISTINCT Ap2.test1, Count(Ap2.test1 ) AS
AantalVantest 1 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
6550
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 to count all the rows except those with a zero sale price, (which are unsold). The table shows works offered for sale by an artist, with a positive figure under SalePrice indicating a sale, and I want to count the number sold by each auction...
5
11515
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 anticipation, Regards,
2
1601
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 find anything online on the subject... <asp:TextBox id="txtRefNum" runat="server"></asp:TextBox> I thought I could use a validator for the process and make the user add the zeros, but of course that is a big no-no! Please help!!
6
1416
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 find anything online on the subject... <asp:TextBox id="txtRefNum" runat="server"></asp:TextBox> I thought I could use a validator for the process and make the user add the zeros, but of course that is a big no-no! Please help!!
2
1750
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 select statement. what am I doing wrong? Here is my code Dim Zeros As Integer Zeros = "SELECT Count(MarketDataTemp.ACPS) AS CountOfACPS" & _ "FROM MarketDataTemp" & _ "WHERE (((MarketDataTemp.ACPS)=0));" ...
29
1955
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
11338
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 the input 0 and display the average as a floating point number. What can I use to count the input values? Example: If I type 1, 2 and 0 the average should be 1.5 Ps: I'm a beginner...
6
7767
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 each file that he has us process. He wants this in a Comma Delimited Format.
3
9922
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 in the Edit option, then all the zeros containing the numbers 360, 90, 502, etc. will be deleted. Some nice person helped me with the following code to delete the zeros: Selection.Replace What:="0", Replacement:="" , but unfortunately this code...
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10439
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10165
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9043
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7541
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6783
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4113
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 we have to send another system
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.