Let me amend my previous suggestion w/: SELECT DISTINCT (Part & Dept & Seq) FROM Routing ORDER BY Seq ...
Sorry, I missed your req't of ORDER BY Seq and only saw it while trying to understand what Larry suggested, which appears to be transcendent set operations at (near) their best - a subtle compliment to Larry. Again, my suggestion might not work, but, if it does, it'll probably be faster than Larry's. No shot at Larry, as what he suggested might be just the ticket f/something I'm working on now. Later, Steve in Memphis -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of William Carson Sent: Wednesday, May 08, 2002 3:00 PM To: [EMAIL PROTECTED] Subject: SQL Question Is there a simple (or complex for that matter) SQL statement for the following scenario? Let�s say I have a table called Routing with columns Part (Part Number), Dept (Department), Oper (Operation) and Seq (Sequence) with the following data: Part Dept Oper Seq ABC 1 1.1 1 ABC 1 1.2 2 ABC 2 2.1 3 ABC 2 2.3 4 ABC 1 1.1 5 ABC 1 1.4 6 ABC 15 15.2 7 ABC 15 15.6 8 ABC 15 15.9 9 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 I tried: SELECT Part,Dept,MIN(Oper) FROM Routing GROUP BY Part,Dept ORDER BY Seq But I guess in a GROUP BY you can�t ORDER BY a column not in the SELECT. Does anyone have any suggestions? Even if it takes more than one SQL statement or view. Thank in advance. Bill ================================================ 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/
