Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

GroupBy query with todays  date

Posted on 2014-07-21
9
Medium Priority
?
174 Views
Last Modified: 2014-07-21
Access 2010:

SELECT Count(dbo_Desc_Search_Log.ProcRun) AS CountOfProcRun, dbo_Desc_Search_Log.QueryDate
FROM dbo_Desc_Search_Log
GROUP BY dbo_Search_Log.ProcRun, dbo_Desc_Search_Log.QueryDate
HAVING (((dbo_Desc_Search_Log.ProcRun)="1"));

I need to run this same query but only include records from todays date from the field.

 dbo_Desc_Search_Log.QueryDate

The format for this field is like this:
7/21/2014 8:35:35 AM

Just need with todays date(everyday)  


Thanks
fordraiders
0
Comment
Question by:fordraiders
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 31

Accepted Solution

by:
Helen Feddema earned 2000 total points
ID: 40209028
If QueryDate is a Date field, then adding a Where clause should do it:
WHERE QueryDate = Date()

If not, then you would need to convert it to a Date value using CDate().
0
 
LVL 3

Author Comment

by:fordraiders
ID: 40209058
i have tried  =date()

CountOfProcRun      QueryDate
1      7/21/2014 8:57:15 AM
1      7/21/2014 8:56:59 AM
1      7/21/2014 8:56:34 AM
1      7/21/2014 8:56:25 AM
1      7/21/2014 8:56:24 AM
1      7/21/2014 8:56:21 AM
1      7/21/2014 8:56:21 AM
1      7/21/2014 8:56:18 AM

Just trying to get everything starting with todays date... without say explicitly 7/21/2014...the time does not matter.
0
 
LVL 31

Expert Comment

by:Helen Feddema
ID: 40209224
It looks as if you are getting the results you want -- all those records have today's date.  Is there still a problem?  If so, what is the problem?
0
10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

 
LVL 3

Author Comment

by:fordraiders
ID: 40209244
The result i'm looking for is a count

CountOfProcRun
  8
0
 
LVL 31

Expert Comment

by:Helen Feddema
ID: 40209359
Make a calculated field like this:  Format(QueryDate, "m/d/yyyy"), and do a count on that.  This will eliminate the times that are causing separate records.  You may have to tweak the query to make sure that other fields don't cause extra records.  It would help if you could post the database, or a cut-down version of it.
0
 
LVL 31

Expert Comment

by:hnasr
ID: 40209434
Try:

SELECT Count(dbo_Desc_Search_Log.ProcRun) AS CountOfProcRun, 
              FORMAT(dbo_Desc_Search_Log.QueryDate,"mm/dd/yyyy")
 FROM dbo_Desc_Search_Log
 GROUP BY dbo_Search_Log.ProcRun, FORMAT(dbo_Desc_Search_Log.QueryDate,"mm/dd/yyyy")
 HAVING (((dbo_Desc_Search_Log.ProcRun)="1"));

Open in new window

0
 
LVL 3

Author Comment

by:fordraiders
ID: 40209818
ok but i need it specifically for today's date..
in  this case 7/21/2014

tomorrow
7/21/2014
0
 
LVL 3

Author Comment

by:fordraiders
ID: 40209819
hnasr, I will check that query..Thanks
0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 40210006
using date function, just ended up nesting 2 queries.
0

Featured Post

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

670 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