Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Retrieve only recs that =1 and not > 1?
Ok, try
select idnum from table where status = 2 INTERSECT
select idnum from table where status < 3;
Hope that helps,
Cindy
Zekmoe wrote:
> Hello,
> I am trying to retrieve only the records in a table that are equal to a value,
> and don't have additional records with values greater. To clarify, the table is
> simplified like this:
> IDNum Status
> 123 1
> 123 2
> 123 3
> 124 1
> 124 2
> 125 1
> 125 2
> 125 3
> I need to get all the IDNum that are Status 2 but have not yet reached status
> 3. Therefore I only need IDNum 124. Something like this
> (pseudo) Select IDNum from table where IDNum = 2 but not greater than 2;
> If I just specify < 3, I get 123 and 125 where the Status is 2.
> Any help greatly appreciated.
> Bob Maggio
> zekmoe_at_aol.com
Received on Wed Jun 30 1999 - 21:25:42 CDT