group by week per month per year

  • Hi, all

    need help with this report and this is the code

    SELECT

    CT.NAME AS BILL_TO_NAME,

    IT.ITEMNAME,

    SUM(SL.qtyordered) as quantity,

    FROM

    [x].[dbo].x SL (NOLOCK)

    INNER JOIN

    x.[dbo].x ST (NOLOCK)

    ON SL.x = ST.x

    AND SL.x = ST.x

    INNER JOIN

    x.[dbo].x CT (NOLOCK)

    ON CT.x = ST.x

    AND SL.x = CT.x

    INNER JOIN

    x.[dbo].x IT (NOLOCK)

    ON SL.x = IT.x

    AND SL.x = IT.x

    WHERE IT.x = 'Fluor-A Day 0.50mg Chewable Tablets' AND

    --EXCLUDE Returns

    ST.x='' AND

    --EXCLUDE Sample Orders. Orders for zero dollars

    SL.x > '0' --AND SL.Createddatetime between @StartDate and @EndDate

    GROUP BYCT.x,IT.x

    --dont know if this the right way i am doing--please see the attached image--

    Thank you all for looking at it..............

  • Is ct.name the companyname you wanted listed on the vertical axis?

    So in the sql statement id group on ct.name, and a function like this - DATEADD(day, -1* Datepart(dw, GETDATE()) + 1, GETDATE())

    then in the report you can put the horizontal grouping on your date function and vertical grouping on ct.name.

    Thats problaby the best I can tell you with the info you provided. If you need assistance at a more detailed level, provide more details.

  • Hi, getoffmyfoot

    can you tell me what more details you would like to know

    thank you

  • You should really only post your question in one thread. I answered in your other thread.

    http://qa.sqlservercentral.com/Forums/Topic1001348-150-1.aspx

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply