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

x
?
Solved

access query counting entries by date

Posted on 2014-04-30
4
Medium Priority
?
405 Views
Last Modified: 2014-05-01
Hi

I have a table which stores the datetime that a survey was completed, along with the surveyid... simple stuff...

my table is storing the date and time in the datetime field.

now I want to create a query that gives output like this:

01/01/2014 - 10
02/01/2014 - 21
03/01/2014 - 39
....


and so on.



SELECT pd_entries.time_stamp, Count(pd_entries.time_stamp) AS num, pd_entries.sessionid
FROM pd_entries
GROUP BY pd_entries.time_stamp, pd_entries.sessionid
HAVING (((pd_entries.sessionid)=5));

Open in new window



I am getting a count of 1 next to each date entry, because the time is different on each entry... doh..


time_stamp                      num      sessionid
29/04/2014 07:00:00      1      5
29/04/2014 07:44:17      1      5
29/04/2014 07:46:16      1      5
29/04/2014 07:56:25      1      5
29/04/2014 11:04:04      1      5
29/04/2014 11:05:03      1      5

is there any way for me to change the query to look just at the date?
0
Comment
Question by:cycledude
[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
  • 2
  • 2
4 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40031958
try

SELECT pd_entries.time_stamp, Count(datevalue(pd_entries.time_stamp)) AS num, pd_entries.sessionid
FROM pd_entries
GROUP BY datevalue(pd_entries.time_stamp), pd_entries.sessionid
HAVING (((pd_entries.sessionid)=5));
0
 

Author Comment

by:cycledude
ID: 40033920
Thanks, had a go, got the following message

"You tried to execute a query that does not include the specified 'time_stamp' as part of an aggregate function"
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 40034309
sorry

SELECT datevalue(pd_entries.time_stamp), Count(datevalue(pd_entries.time_stamp)) AS num, pd_entries.sessionid
FROM pd_entries
GROUP BY datevalue(pd_entries.time_stamp), pd_entries.sessionid
HAVING (((pd_entries.sessionid)=5));
0
 

Author Closing Comment

by:cycledude
ID: 40034480
thanks ;o)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
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…

704 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