Return weekly values

  • Good afternoon all,

    I know that some of you may have issues with me not posting test but, I did not have time to figure that method out. Hence the title "Newbie". However, I have a new issue:

    Select SUM(UnitsProd) As Total_Units from tbl_Assembly_Production

    This works but, I want to return values per week. So, I was looking around and found something in Oracle. I'm sure there is something in SQL. Can someone point me in the right direction?

    Thanks

    DJ Khalif

  • Ok, this is close to what I am looking for. I need to return each date once but aggregate my Units Produced.

    SELECT DATEADD(wk, DATEDIFF(wk, 6, DateProd), 6) AS Weekly_Production, SUM(UnitsProd) AS Total_Units

    FROM tbl_Assembly_ProductionTest

    GROUP BY DateProd

    ORDER BY DateProd

  • kabaari (9/29/2009)


    Ok, this is close to what I am looking for. I need to return each date once but aggregate my Units Produced.

    SELECT DATEADD(wk, DATEDIFF(wk, 6, DateProd), 6) AS Weekly_Production, SUM(UnitsProd) AS Total_Units

    FROM tbl_Assembly_ProductionTest

    GROUP BY DateProd

    ORDER BY DateProd

    change your GROUP BY and ORDER BY clause to

    GROUP BY DATEADD(wk, DATEDIFF(wk, 6, DateProd), 6)

    ORDER BY Weekly_Production[/quote]



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • Lutz,

    Thanks a lot. That did it.

    Much respect,

    DJ Khalif

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

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