|
|
On Jul 31, 11:51 am, "Hagster" <webforumsu...@xxxxxxxxxxxxxx> wrote:
> Hello All
>
> Any ideas on the best way to work out what month a particular week is in.
>
> Im getting my data returned from the SQL server groupped by 'datepart' see
> below
>
> So im getting a list of orders totaled by week.
>
> the week is the week number i.e. wk31 wk32 wk33
> How can I determin what month wk31 falls in for reporting I want to display
> the month with the apropriat weeks below it.
>
> Kind Regards Guy
> and thanks for any help in advance.
>
> ************ SQL for datepart grouping *****************
>
> SELECT wpart, DATEPART(ww, wfindate) AS wfindate, COUNT(wpart) AS tot_in_week
> FROM worksorders
> WHERE (wfindate BETWEEN CONVERT(DATETIME, '2008-01-01 00:00:00', 102) AND
> CONVERT(DATETIME, '2008-12-31 00:00:00', 102))
> GROUP BY wpart, DATEPART(ww, wfindate)
> ORDER BY wpart, wfindate
Get the month from the date...
|
|