Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 11 to 11 of 11 total |
Query Help Please |
Thu, Jul 12 2007 4:27 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. 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 Page | Page 2 of 2 | |
Jump to Page: 1 2 |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |