Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> SQL Puzzle - Finding Max Sequence

SQL Puzzle - Finding Max Sequence

From: <papollo_bates_at_my-deja.com>
Date: Tue, 12 Oct 1999 19:55:10 GMT
Message-ID: <7u03ml$a4m$1@nnrp1.deja.com>


I have a table with three fields:

  1. ID is a number field
  2. Sequence_No is a number field
  3. Grade is a VARCHAR2(1), holding A, B, C, D, E

There are 100 individual IDs, each with more than one record. As a record is inserted for an ID, the next Sequence_No for that ID is used.  So, ID 100 has Sequence_No values of 1, 2, 3, 4, etc., as does ID 101 and every other ID

I want to select all IDs with a Grade of A or B, but I can only look at their highest Sequence_No when checking their grade. I can"t figure out the MAX(Sequence_No) part.

Thanks!

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Tue Oct 12 1999 - 14:55:10 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US