Hello,
Can someone help a newbie with some code -
As an example -
I have a table ProductionRaw
[DTStamp] [timestamp] NOT NULL,
[Product] nvarchar NOT NULL,
[Shift] [int] NOT NULL,
[Weight] [real] NOT NULL
With Values -
07-1-2018 7:10:05, A, 1, 10
07-1-2018 12:10:05, A, 2, 10
07-1-2018 20:10:05, A, 3, 10
09-10-2018 7:10:05, A, 1, 5
09-10-2018 12:10:05, A, 2, 10
09-10-2018 20:10:05, A, 3, 15
09-11-2018 7:10:05, B, 1, 1
09-11-2018 12:10:05, B, 2, 2
09-11-2018 20:10:05, B, 3, 3
09-12-2018 7:10:05, A, 1, 10
09-12-2018 12:10:05, A, 2, 20
09-12-2018 20:10:05, A, 3, 30
09-13-2018 7:10:05, B, 1, 50
09-13-2018 12:10:05, B, 2, 25
09-13-2018 20:10:05, B, 3, 35
On insert of each row in the above table, I need to populate a table to display as below -
ProductName, 1stShift, 2nd Shift, 3rdShift, Total Monthly, YTD
A, 15, 30, 45, 90, 120
B, 51, 27, 38, 116, 116
Thanks,
Mohit.