Claudine It appears you haven't yet read the Advanced SQL book you ordered from me a while back (grin!)
See Unit 2, SELDEMO.RMD, examples 4.33 - 4.36 David David Blocker [EMAIL PROTECTED] 781-784-1919 Fax: 781-784-1860 Cell: 339-206-0261 ----- Original Message ----- From: "claudinerobbins" <[EMAIL PROTECTED]> To: "RBG7-L Mailing List" <[email protected]> Sent: Friday, March 04, 2005 7:06 PM Subject: [RBG7-L] - Re: Date Function > 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 > >
