Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hello,Not sure how to do this query…I have a table with 2 fields:- Date- Size (vales range between 1 and 100)Is it possible in a query to group the values by month and then have the query average the size for each month?Thanks for any help!Shane
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2009-10-02 : 12:50:22
yup. its possible
SELECT DATEADD(mm,DATEDIFF(mm,0,Date),0),AVG(Size*1.0)FROM TableGROUP BY DATEADD(mm,DATEDIFF(mm,0,Date),0)