bud,

try this:

SELECT Cust_ID, Order_Date, Month(Order_Date) AS Order_Month,
SUM(Order_Total]) AS Total
FROM Orders
GROUP BY Month(Order_Date), Cust_ID, Order_Date
HAVING Year(Order_Date) = Year(Now());

~ dina


----- Original Message -----
From: "Bud" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, April 29, 2002 11:48 AM
Subject: OT: SQL Question


> Howdy all. I have a client that wants me to build him a
reporting
> section based on the order month. I know how to do a SQL to get
like
> the total of orders for a particular customer.
>
> SELECT Cust_ID, SUM(Order_Total) AS Total
> FROM Orders
> GROUP BY Cust_ID
>
> But, is there a way to group on the month? Something like:
>
> SELECT Cust_ID, Order_Date, SUM(Order_Total) AS Total
> FROM Orders
> GROUP BY Cust_ID, DatePart(Month)
>
> Thanks.
> --
>
> Bud Schneehagen - Tropical Web Creations
>
> _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
> ColdFusion Solutions / eCommerce Development
> [EMAIL PROTECTED]
> http://www.twcreations.com/
> 954.721.3452
>
_________________________________________________________________
_____
> Signup for the Fusion Authority news alert and keep up with the
latest news in ColdFusion and related topics.
http://www.fusionauthority.com/signup.cfm
> FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
> Archives:
http://www.mail-archive.com/cf-talk@houseoffusion.com/
> Unsubscribe:
http://www.houseoffusion.com/index.cfm?sidebar=lists

______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to