does this simple query result in grouping the attachments by day and giving me the total number of daily attachments as well as the average size?
the only table i am querying is attachmentdetail (email attachments)
[attachmentdetail]
AttachmentId int
Name varchar
Size int
IsInline bit
InsertedDatetime datetime
select
count(*) as [Tally],
avg( cast(size as decimal)/1024/1024) as avgSize,
DateAdd(dd, DateDiff(dd, 0, InsertedDatetime), 0) As [date_only]
from attachmentdetail
where isinline <>1
group by DateAdd(dd, DateDiff(dd, 0, InsertedDatetime), 0)
order by [date_only] desc
also how to i keep the values i get from my avg() to 2 decimal places?