Thanks Sami and Larry, And the winner is:
BROWSE * FROM D_Invoice_Status D1 WHERE invoice_id = 33979 and Inbox_State = 2 AND NOT EXISTS (SELECT * FROM D_Invoice_Status WHERE invoice_id = d1.invoice_id AND State_Changed_Dt < D1.State_Changed_Dt) Claudine :) -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Lawrence Lustig Sent: Friday, March 04, 2005 5:36 PM To: RBG7-L Mailing List Subject: [RBG7-L] - Re: Date Function > bro * fro d_invoice_status where inbox_state = 2 and > (lmin(state_changed_dt)) BROWSE & FROM D_Invoice_Status D1 WHERE Inbox_State = 2 AND + NOT EXISTS (SELECT * FROM D_Invoice_Status + WHERE State_Changed_Dt < D1.State_Changed_Dt) will show the single row with the lowest State_Changed_Dt and BROWSE & FROM D_Invoice_Status D1 WHERE Inbox_State = 2 AND + NOT EXISTS (SELECT * FROM D_Invoice_Status + WHERE PrimaryKeyCol = PrimaryKeyCol AND + State_Changed_Dt < D1.State_Changed_Dt) will show the lowest-dated row for each PrimaryKeyCol value. -- Larry
