This will work, but it will group by dates down to the second.  So that means 
the query won't return any grouped records unless they actually occurred on the 
exact same second.
 
You need to use DATEPART() or a similar function, to group by the Year and the 
Month such as YYYYMM.  That is the only way you can really group the results 
correctly.
 
M!ke

________________________________

From: eric.creese [mailto:[EMAIL PROTECTED]
Sent: Wed 6/22/2005 6:34 PM
To: CF-Talk
Subject: Re: group by date, missing something



SELECT sum(saleTotal), saledate
FROM sales
GROUP BY saledate

----- Original Message -----
From: "mayo" <[EMAIL PROTECTED]>
To: "CF-Talk" <cf-talk@houseoffusion.com>
Sent: Wednesday, June 22, 2005 6:29 PM
Subject: group by date, missing something


> I'm trying to do a group by date on an access db.
>
> I have a list of sales and want to group by month and year. I can't get
> even a test run to work
>
> SQL below:
>
>             SELECT MONTH(saleDate) AS theMonth, sum(saleTotal) as
> dailyTotal
>             FROM sales
>             GROUP by theMonth
>
> Thx
>
> -- gil
>
>
>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:210304
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to