Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Adding Nonexisting field

Adding Nonexisting field

Adding Nonexisting field

This is my current SQL:
Select xawWorkCenterID,xawDescription,Est_Hrs,Act_Hrs,Prod_Eff From WorkCenters left outer join
(Select jmoWorkCenterID as WeekWC, (sum(jmoSetupHours)+sum(jmoEstimatedProductionHours)) as Est_Hrs, (sum(jmoActualSetupHours)+sum(jmoActualProductionHours)) as Act_Hrs,
case when sum(jmoActualProductionHours) <> 0.00 then ((sum(jmoEstimatedProductionHours)+sum(jmoSetupHours)) / (sum(jmoActualProductionHours)+sum(jmoActualSetupHours)))*100.00 else 0 end as Prod_Eff
from JobOperations where jmoProductionComplete <> 0 and exists
(select lmlTimecardID from TimecardLines where lmlActualEndTime between dateadd(ww,-6,Getdate()) and getdate() and lmlJobID = jmoJobID and lmlJobAssemblyID = jmoJobAssemblyID and lmlJobOperationID = jmoJobOperationID and
lmlTimecardID = (select top 1 lmlTimecardID from TimecardLines where lmlJobID = jmoJobID and lmlJobAssemblyID = jmoJobAssemblyID and lmlJobOperationID = jmoJobOperationID Order By lmlActualEndTime desc))
group by jmoWorkCenterID) as Week on WeekWC = xawWorkCenterID

This is how it is viewed:

My query adds a totals row with the sum of both est and act hours but I want the average of the "Prod_Eff" How can I add a row with the average of Prod_Eff? Any suggestions are helpful

RE: Adding Nonexisting field

I think that depends on how your Prod_Eff is calculated.

For instance, I can see that Work Centers 110 & 120 both have somewhat similar efficiencies, however the hours are vastly different. Simply averaging the two efficiencies, in this abreviated exercise, to 84 would be giving WC 110 more weight than WC 120, it seems to me.


glassesJust traded in my OLD subtlety...
for a NUance!tongue

"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close