question

technette avatar image
technette asked

Average Labor Hours

Hi! I was given a great solution for getting total labor hours for each part in the assembly. is there a way to get an average labor hours for each part? SELECT ct.[BASE] ,ct.[BASEDescription] ,ct.[PART_ID] ,ct.DESCRIPTION ,SUM(tt.LABOR_HOURS) AS Total_LABOR_HOURS ,SUM(tt.LABOR_COST) AS Total_LABOR_COST FROM [Database1].[dbo].[CarrieTbl] ct INNER JOIN Database2.dbo.TT_HOUR_DETAILS tt ON ct.[PART_NO]=tt.PART_ID GROUP BY ct.[BASE] ,ct.[BASEDescription] ,ct.[OP] ,ct.[PART_ID] ,ct.DESCRIPTION
group-byaverage
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
rj_leo avatar image
rj_leo answered
like this: SELECT ct.[BASE] ,ct.[BASEDescription] ,ct.[PART_ID] ,ct.DESCRIPTION ,SUM(tt.LABOR_HOURS) AS Total_LABOR_HOURS ,SUM(tt.LABOR_COST) AS Total_LABOR_COST ,AVG(tt.LABOR_HOURS) AS Average_LABOR_HOURS FROM [Database1].[dbo].[CarrieTbl] ct INNER JOIN Database2.dbo.TT_HOUR_DETAILS tt ON ct.[PART_NO]=tt.PART_ID GROUP BY ct.[BASE] ,ct.[BASEDescription] ,ct.[OP] ,ct.[PART_ID] ,ct.DESCRIPTION
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.