Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

access query counting entries by date

Posted on 2014-04-30
4
Medium Priority
?
412 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
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

783 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