Hello again,
I have a somewhat more difficult problem, this time.
Here is the SQL code I am working with, so far.
SELECT Wo_headc.WO_NBR AS "Work Order Number", Wo_headc.CMP_DT AS "Completion Date", Wo_sthsc.FROM_STS AS "Status", Sum(Wo_sthsc.DAYS_IN_STS) AS "Days in Status", Wo_headc.ATA_MAN_NBR AS "Manual Number", IIF((Wo_headc.ATA_MAN_NBR) Like '__-__-__','Commercial','Military') AS "M/C"
FROM Wo_headc Wo_headc, Wo_sthsc Wo_sthsc
WHERE Wo_headc.WO_NBR = Wo_sthsc.WO_NBR AND ((Wo_headc.CMP_DT>={d '2010-12-15'} And Wo_headc.CMP_DT<={d '2011-01-15'}))
GROUP BY Wo_headc.WO_NBR, Wo_headc.CMP_DT, Wo_sthsc.FROM_STS, Wo_headc.ATA_MAN_NBR
Basically, there are 4 status codes that must be in every work order : (ICI, CTD, NIS, and WIP). Some work orders are missing some of these status codes. What I would like is for the query to search by Work Order, and check to see if all 4 status codes are available. If they are not, I want it to add the missing codes, and populate the "Days in Status" field with 0's.
Hopefully this isn't as complex as I think it is. I'm a beginner, so I'd appreciate it if one of the resident experts here could point me in the right direction.
Thanks in advance.
I have a somewhat more difficult problem, this time.
Here is the SQL code I am working with, so far.
SELECT Wo_headc.WO_NBR AS "Work Order Number", Wo_headc.CMP_DT AS "Completion Date", Wo_sthsc.FROM_STS AS "Status", Sum(Wo_sthsc.DAYS_IN_STS) AS "Days in Status", Wo_headc.ATA_MAN_NBR AS "Manual Number", IIF((Wo_headc.ATA_MAN_NBR) Like '__-__-__','Commercial','Military') AS "M/C"
FROM Wo_headc Wo_headc, Wo_sthsc Wo_sthsc
WHERE Wo_headc.WO_NBR = Wo_sthsc.WO_NBR AND ((Wo_headc.CMP_DT>={d '2010-12-15'} And Wo_headc.CMP_DT<={d '2011-01-15'}))
GROUP BY Wo_headc.WO_NBR, Wo_headc.CMP_DT, Wo_sthsc.FROM_STS, Wo_headc.ATA_MAN_NBR
Basically, there are 4 status codes that must be in every work order : (ICI, CTD, NIS, and WIP). Some work orders are missing some of these status codes. What I would like is for the query to search by Work Order, and check to see if all 4 status codes are available. If they are not, I want it to add the missing codes, and populate the "Days in Status" field with 0's.
Hopefully this isn't as complex as I think it is. I'm a beginner, so I'd appreciate it if one of the resident experts here could point me in the right direction.
Thanks in advance.