> What I'm trying to do is find out which tranids have
> a "WO Completed" that
> comes before the "WO Approved" comparing
> tranactiondts.

Either of the following should do it (untested code!):

SELECT * FROM Transactions T1 +
  WHERE Transaction = 'WO Approved' AND +
   EXISTS (SELECT * FROM Transactions T2 WHERE +
   TranID = T1.TranID AND +
   Transaction = 'WO Completed' AND +
   TransactionDt < T1.TransactionDt)

OR

SELECT T1.TranID, +
       T1.TransactionDt AS ApprDate, +
       T2.TransactionDt AS ComplDate +
  FROM Transaction T1, Transaction T2 +
  WHERE T1.TranID = T2.TranID AND +
    T1.Transaction = 'WO Approved' AND +
    T2.Transaction = 'WO Complete' AND +
    T1.TransactionDt < T2.TransactionDt

--
Larry Lustig



        
                
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

Reply via email to