|
Posted by Rick Brown on January 11, 2006, 12:07 pm
Please log in for more thread options That's a keeper! (g) Very handy.
> All date fields in SQL Server include the time. When you use Group By,
> the values must match exactly to be grouped, so a date field doesn't work
> very well fro grouping as you have seen as you end up with a group for
> each second or millisecond...
>
> To fix this you need to CONVERT the date into a string that only includes
> the date...
>
> Enter this in the "Formula" line of the Column definition for your new
> column:
>
> Formula = "CONVERT(datetime, CONVERT(varchar(10), DateCreated, 101), 101)"
>
> This is going to convert the DateCreated to a text (varchar) value
> striping off the time, then convert it back to a datetime with a default
> time of 00:00:00 so that all of the date filters will still work as they
> do currently ...
>
> Hope that helps...
>
>
>
> --
> --
> Glenn Adams
> Tiber Creek Consulting
> http://www.tibercreek.com
> glenn@tibercreek.com
> ----------------------------------------------
> Please DO NOT respond to me directly but post all responses here in the
> newsgroup so that all can share the information
>
>>I am working on updating the Shipping Log report. I've added the Date
>>Created field, and I would like to group the report by that field, so that
>>I can get a total of shipping charges collected by day each month.
>>However, when I arrange the report to do that, the date field expands to
>>include the timestamp, so each shipping record is on its own line. Am I
>>overlooking an easy way to tell the report to exclude the timestamps and
>>group by day only? Any advice would be appreciated.
>>
>>
>
>
|