Should the ORDER BY be Ascending then?
Bob Peterson
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Wednesday, July 06, 2016 9:37 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Re: Counting dates in a month
That almost worked. But I need to put in date order October 2015 through June 2016... Here is what I got right now.
SELECT Format([MOVEINDATE],"mmmm"" , ""yyyy") AS [Month of Move-In], Count(tblTenantListing.ID) AS [Total Move-In]
FROM tblTenantListing
WHERE (((tblTenantListing.MOVEINDATE) Between #10/1/2015# And #6/30/2016#))
GROUP BY Format([MOVEINDATE],"mmmm"" , ""yyyy")
ORDER BY Format([MOVEINDATE],"mmmm"" , ""yyyy") DESC;
With Warm Regards,
Arthur D. Lorenzini
IT System Manager
Cheyenne River Housing Authority
Wk.(605)964-4265 Ext. 130
Fax (605)964-1070
"Anyone who claimed that old age had brought them patience was either lying or senile."
From: "graham@mandeno.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>
To: MS_Access_Professionals@yahoogroups.com
Sent: Tuesday, July 5, 2016 5:06 PM
Subject: [MS_AccessPros] Re: Counting dates in a month
Hi Art
Remove tblTenantListing.MOVEINDATE from the GROUP BY. Having it there causes a new aggregate record for every different date.
You will probably also need to change HAVING to WHERE.
Best regards,
Graham Mandeno [Access MVP 1996-2015]
---In MS_Access_Professionals@yahoogroups.com, <dbalorenzini@...> wrote :
I am trying to count the number of records by month.
SELECT Format([MOVEINDATE],"mmmm"" , ""yyyy") AS [Month of Move-In], Count(tblTenantListing.ID) AS [Total Move-In]
FROM tblTenantListing
GROUP BY Format([MOVEINDATE],"mmmm"" , ""yyyy"), tblTenantListing.MOVEINDATE
HAVING (((tblTenantListing.MOVEINDATE) Between #10/1/2015# And #6/30/2016#));
Currently this gives me the following:
Query1 | |
Month of Move-In | Total Move-In |
April , 2016 | 1 |
April , 2016 | 1 |
April , 2016 | 1 |
April , 2016 | 1 |
April , 2016 | 1 |
April , 2016 | 2 |
December , 2015 | 1 |
December , 2015 | 1 |
December , 2015 | 1 |
February , 2016 | 3 |
February , 2016 | 1 |
February , 2016 | 1 |
February , 2016 | 1 |
February , 2016 | 1 |
January , 2016 | 1 |
January , 2016 | 1 |
January , 2016 | 1 |
January , 2016 | 1 |
March , 2016 | 4 |
March , 2016 | 1 |
March , 2016 | 1 |
March , 2016 | 1 |
March , 2016 | 1 |
May , 2016 | 1 |
May , 2016 | 1 |
May , 2016 | 1 |
May , 2016 | 1 |
November , 2015 | 1 |
November , 2015 | 1 |
November , 2015 | 1 |
November , 2015 | 1 |
October , 2015 | 1 |
What I actually need is one record per month. Any ideas?
THank you,
Arthur Lorenzini
Sioux Falls, SD
Posted by: Robert Peterson <bob@alternatefinishing.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (4) |
Tidak ada komentar:
Posting Komentar