d4135e8ad3
The WHERE clause was comparing Code to itself instead of the aliased table reference, which would always be true.
27 lines
850 B
SQL
27 lines
850 B
SQL
-- WorkOrderTime Archive Query
|
|
-- Source: QADTA.F31122 (current) + ARCDTAQA.F31122 (archived)
|
|
-- Used by: GetWorkOrderTimesArchive() - on-demand historical retrieval
|
|
-- Note: Not scheduled, used for historical lookups
|
|
|
|
SELECT wot.WTUKID AS UniqueID,
|
|
TRIM(wot.WTMMCU) AS BranchCode,
|
|
wot.WTDOCO AS WorkOrderNumber,
|
|
wot.WTOPSQ AS StepNumber,
|
|
wot.WTAN8 AS AddressNumber,
|
|
wot.WTDGL AS GlDate,
|
|
wot.WTUPMJ AS DateUpdated,
|
|
wot.WTTDAY AS TimeUpdated
|
|
FROM QADTA.F31122 wot
|
|
|
|
UNION ALL
|
|
|
|
SELECT wot.WTUKID AS UniqueID,
|
|
TRIM(wot.WTMMCU) AS BranchCode,
|
|
wot.WTDOCO AS WorkOrderNumber,
|
|
wot.WTOPSQ AS StepNumber,
|
|
wot.WTAN8 AS AddressNumber,
|
|
wot.WTDGL AS GlDate,
|
|
wot.WTUPMJ AS DateUpdated,
|
|
wot.WTTDAY AS TimeUpdated
|
|
FROM ARCDTAQA.F31122 wot
|