/t5/coldfusion-discussions/i-have-a-challanging-query-problem/td-p/27267Dec 18, 2008
Dec 18, 2008
Copy link to clipboard
Copied
I have a challanging problem. I have a datetime column and a
numerical column. I need a query that returns a set of the average
of the numerical column per month.
Note my data is spread over years so I need to group by mm yy
/t5/coldfusion-discussions/i-have-a-challanging-query-problem/m-p/27269#M2873Dec 18, 2008
Dec 18, 2008
Copy link to clipboard
Copied
LATEST
Wait a minute I think this is it:
SELECT SUBSTRING(CONVERT(VARCHAR(8), valueDate, 3), 4, 5) AS
mmyy
,avg(rate)
FROM [commercial].[dbo].[OTT_DEALS]
group by SUBSTRING(CONVERT(VARCHAR(8), valueDate, 3), 4,
5)