Icon View Thread

The following is the text of the current message along with any replies.
Messages 11 to 11 of 11 total
Thread Query Help Please
Thu, Jul 12 2007 4:27 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Silven,

<< from the example of input data below:  I would like to calculate the
difference (Turn Around Time) between the AcquiredDT for a Spec
Turn Around Time = Spec's max(state) AcquiredDT - Spec's min(state)
AcquiredDT
in the example code entries below I need to see something like: >>

Okay, you'll need a script to do this:

SELECT SpecID,
MIN(State) AS MinState,
CAST(NULL AS TIMESTAMP) AS MinAcquiredDT,
MAX(State) AS MaxState,
CAST(NULL AS TIMESTAMP) AS MaxAcquiredDT
INTO "\Memory\SpecStates"
FROM Specs
GROUP BY SpecID;

UPDATE "\Memory\SpecStates" SET MinAcquiredDT=AcquiredDT
FROM "\Memory\SpecStates" INNER JOIN Specs ON
Specs.SpecID=SpecStates.SpecID AND Specs.State=SpecStates.MinState;

UPDATE "\Memory\SpecStates" SET MaxAcquiredDT=AcquiredDT
FROM "\Memory\SpecStates" INNER JOIN Specs ON
Specs.SpecID=SpecStates.SpecID AND Specs.State=SpecStates.MaxState;

SELECT SpecID,
ROUND((MaxAcquiredDT-MinAcquiredDT) / (1000 * 60)) AS TAT
FROM "\Memory\SpecStates";

--
Tim Young
Elevate Software
www.elevatesoft.com

« Previous PagePage 2 of 2
Jump to Page:  1 2
Image