I think the L in SQL stands for Larry. The statement works great!
Thanks, Bill -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of William Carson Sent: Thursday, May 09, 2002 8:43 AM To: [EMAIL PROTECTED] Subject: RE: SQL Question I will try this one today and let you know how it works. Bill -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Lawrence Lustig Sent: Wednesday, May 08, 2002 9:32 PM To: [EMAIL PROTECTED] Subject: Re: SQL Question << I am looking for an SQL statement that will return the list of departments that is goes through and the order in which it goes through them. In other words, I want: Part Dept ABC 1 ABC 2 ABC 1 ABC 15 Does anyone have any suggestions? Even if it takes more than one SQL statement or view. >> It only takes one. This assumes that Seq is an Integer column: SELECT Part, Dept FROM Routing R1 WHERE NOT EXISTS + (SELECT * FROM Routing R2 WHERE R2.Part = R1.Part AND R2.Dept = R1.Dept AND R2.Seq = (R1.Seq-1)) I tried it on your data, and it produced the results you want. In brief, it selects only those rows for which the immediately preceding sequence number does not have the same part and dept values. -- Larry ================================================ TO SEE MESSAGE POSTING GUIDELINES: Send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: INTRO rbase-l ================================================ TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: UNSUBSCRIBE rbase-l ================================================ TO SEARCH ARCHIVES: http://www.mail-archive.com/rbase-l%40sonetmail.com/ ================================================ TO SEE MESSAGE POSTING GUIDELINES: Send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: INTRO rbase-l ================================================ TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: UNSUBSCRIBE rbase-l ================================================ TO SEARCH ARCHIVES: http://www.mail-archive.com/rbase-l%40sonetmail.com/ ================================================ TO SEE MESSAGE POSTING GUIDELINES: Send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: INTRO rbase-l ================================================ TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: UNSUBSCRIBE rbase-l ================================================ TO SEARCH ARCHIVES: http://www.mail-archive.com/rbase-l%40sonetmail.com/
