473,473 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to Count Dates with a Criteria

Hi, I have a simple question. I wanted to count a Column containing
Dates and the word "Empty".

This is what I am trying to do.

Closed Dates
------------
4/2/2004
4/7/2004
4/9/2004
Empty
4/5/2004
7/3/2004
Empty
Empty
And come out with

Empty: 3

and in another query

Date: 5
Here is what I am attempting, but I am getting a data type mismatch
error.. I am trying to using "Empty" and Not "Empty"

SELECT Count(aparFullTable.[PTF Closed]) AS [CountOfPTF Closed]
FROM aparFullTable
HAVING (((Count(aparFullTable.[PTF Closed]))="empty"));
Thanks
Nov 13 '05 #1
2 1348
al******@hotmail.com (Alicia) wrote in message news:<d3**************************@posting.google. com>...
Hi, I have a simple question. I wanted to count a Column containing
Dates and the word "Empty".

This is what I am trying to do.

Closed Dates
------------
4/2/2004
4/7/2004
4/9/2004
Empty
4/5/2004
7/3/2004
Empty
Empty
And come out with

Empty: 3

and in another query

Date: 5
Here is what I am attempting, but I am getting a data type mismatch
error.. I am trying to using "Empty" and Not "Empty"

SELECT Count(aparFullTable.[PTF Closed]) AS [CountOfPTF Closed]
FROM aparFullTable
HAVING (((Count(aparFullTable.[PTF Closed]))="empty"));
Thanks

This should work for you. You can't say Count(fieldname) = "empty"
for Count is numeric. Also this should be Where not Having

SELECT Count(aparFullTable.[PTF Closed]) AS [CountOfPTF Closed]
FROM aparFullTable
Where aparFullTable.[PTF Closed]="empty";
Nov 13 '05 #2
You should be using "WHERE" rather than "HAVING"

SELECT Count(aparFullTable.[PTF Closed]) AS [CountOfPTF Closed]
FROM aparFullTable
WHERE (((Count(aparFullTable.[PTF Closed]))="empty"));

al******@hotmail.com (Alicia) wrote in message news:<d3**************************@posting.google. com>...

Here is what I am attempting, but I am getting a data type mismatch
error.. I am trying to using "Empty" and Not "Empty"

SELECT Count(aparFullTable.[PTF Closed]) AS [CountOfPTF Closed]
FROM aparFullTable
HAVING (((Count(aparFullTable.[PTF Closed]))="empty"));
Thanks

Nov 13 '05 #3

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

Similar topics

5
by: Irfan | last post by:
Hi All, I am trying to create a report but having problem with the critiera selection logic, please help. I have the following fields date1 date2 date3
3
by: Michael Curtis | last post by:
This is kicking my @#$%. I have been asked to do a performance report for our vendors. I need to compare and count dates. 1. Is called which is in a table named JOB DATES 2. Is called which...
5
by: DW | last post by:
I have a query in Access 2003 that has the following criteria SELECT tblOrder.SessionDate, tblMenus.Item_Name, tblOrder.Type, Format$(tblorder!SessionDate,"Short Time") AS SessionTime,...
2
by: falroc | last post by:
I have a data base that is used for billing. I have a form called a report selector form. Below is the code used to create the report from the user inputs on the form. What I want to do is add a...
0
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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
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
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
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
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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.