Solved

MS ACcess 2007 Count query

Posted on 2010-11-18
8
342 Views
Last Modified: 2012-06-27
Hi,

I trying to get the count of all records that are less or equal to 12/31/2010.
I am getting 0 results where I should have over 2500 count.  But, when I change to > it will return all records count.

Your advice will be appreciated!

Thanks,
Rad


SELECT Count("Starting_Date") AS 2010_Count

FROM My_Table

where "Starting_Date" = #12/31/2010#

Open in new window

0
Comment
Question by:Radshaykho
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 28

Accepted Solution

by:
omgang earned 72 total points
ID: 34167121
SELECT Count("Starting_Date") AS 2010_Count
FROM My_Table
where "Starting_Date" <= #12/31/2010#
 
OM Gang
0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 215 total points
ID: 34167129
Shouldn't this be:

SELECT Count([Starting_Date]) AS 2010_Count
FROM My_Table
where [Starting_Date <= #12/31/2010#

mx
0
 
LVL 13

Assisted Solution

by:Rick
Rick earned 142 total points
ID: 34167132
SELECT Count("Starting_Date") AS 2010_Count
FROM My_Table
where "Starting_Date" <= '12/31/2010'
0
 
LVL 13

Assisted Solution

by:Rick
Rick earned 142 total points
ID: 34167140
SELECT Count([Starting_Date]) AS '2010_Count'
FROM My_Table
where [Starting_Date] <= '12/31/2010'
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 215 total points
ID: 34167152
Rad:
Your issue is/was your have your field name as a literal String.  It needs to be enclosed in brackets as I posted.

mx
0
 
LVL 28

Expert Comment

by:omgang
ID: 34167172
'MX, missed a closing bracket
where [Starting_Date] <= #12/31/2010#
OM Gang

0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 215 total points
ID: 34167186
One more time then (thx)

SELECT Count([Starting_Date]) AS 2010_Count
FROM My_Table
where [Starting_Date] <= #12/31/2010#
0
 
LVL 3

Assisted Solution

by:Ronald Buster
Ronald Buster earned 71 total points
ID: 34167194
select count([starting_date]) as [2010_count]
from [my_table]
where [starting_Date] = "#12/31/2010#"
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now