Solved

access query counting entries by date

Posted on 2014-04-30
4
390 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 119

Expert Comment

by:Rey Obrero
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 119

Accepted Solution

by:
Rey Obrero earned 500 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
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 how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

758 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

20 Experts available now in Live!

Get 1:1 Help Now