September 29, 2009 at 10:10 am
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
September 29, 2009 at 11:56 am
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
September 29, 2009 at 1:22 pm
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]
September 29, 2009 at 2:02 pm
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