Gentlemen--
I have a table of records (DEFECT) left-joined to another table (DTEVTS); DTEVTS holds multiple records for each record in DEFECT. The records in DTEVTS are events descirbing the status of a work order-- open, closed, etc.
Ultimately, i want to end up with a flat file holding all the information i need for each record in a single line item (opened date, closed date, etc), but I have a small problem where DTEVTS has a "Closed" event and a "Reopened" event; I can't simply look for a "closed" event and pull that as my "closed date" because it may have been reopened later...
(defect.Record) 111
(dtevts.eventtype)opened (dtevts.date)1/1/2005
(dtevts.eventtype)closed (dtevts.date)1/2/2005
(dtevts.eventtype)reopened (dtevts.date)1/3/2005
(dtevts.eventtype)closed (dtevts.date)1/4/2005
In this example, my closed date would show up as 1/4/2005-- all is well. However...
(defect.Record) 111
(dtevts.eventtype)opened (dtevts.date)1/1/2005
(dtevts.eventtype)closed (dtevts.date)1/2/2005
(dtevts.eventtype)reopened (dtevts.date)1/3/2005
...this work order is actually open, since it was reopened, yet my current code would show a "closed date" of 1/2/2005.
I need to somehow compare the dates of the "reopened" events with the dates of the "closed" events and only count a "closed event" if it's date is greater than any "reopened event". Ideas? Thanks!
I have a table of records (DEFECT) left-joined to another table (DTEVTS); DTEVTS holds multiple records for each record in DEFECT. The records in DTEVTS are events descirbing the status of a work order-- open, closed, etc.
Ultimately, i want to end up with a flat file holding all the information i need for each record in a single line item (opened date, closed date, etc), but I have a small problem where DTEVTS has a "Closed" event and a "Reopened" event; I can't simply look for a "closed" event and pull that as my "closed date" because it may have been reopened later...
(defect.Record) 111
(dtevts.eventtype)opened (dtevts.date)1/1/2005
(dtevts.eventtype)closed (dtevts.date)1/2/2005
(dtevts.eventtype)reopened (dtevts.date)1/3/2005
(dtevts.eventtype)closed (dtevts.date)1/4/2005
In this example, my closed date would show up as 1/4/2005-- all is well. However...
(defect.Record) 111
(dtevts.eventtype)opened (dtevts.date)1/1/2005
(dtevts.eventtype)closed (dtevts.date)1/2/2005
(dtevts.eventtype)reopened (dtevts.date)1/3/2005
...this work order is actually open, since it was reopened, yet my current code would show a "closed date" of 1/2/2005.
I need to somehow compare the dates of the "reopened" events with the dates of the "closed" events and only count a "closed event" if it's date is greater than any "reopened event". Ideas? Thanks!