If you want to group by month you can only output the month and not the
whole date.  i.e.

SELECT Cust_ID, Datepart(m,Order_Date), SUM(Order_Total) AS Total
FROM Orders
GROUP BY Cust_ID, Datepart(m,Order_Date)


-----Original Message-----
From: Bud [mailto:[EMAIL PROTECTED]]
Sent: 29 April 2002 17:48
To: CF-Talk
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

______________________________________________________________________
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