I had forgot to put a NVL, so he is the corrected query..Quote:
Originally Posted by abhaysk
Code:
Select
Id
From
(
Select
Id,
Max(Id_Eliminate) Over (Partition By Id) Id_Eliminate
From
(
Select
Id,
Case When tc not in ('CB', 'CS', 'UT') Then
Id
End Id_Eliminate
From
table_t
Where
ocdate >= to_date('9/26/2006','mm/dd/yyyy') and
ocdate <= to_date('9/27/2007','mm/dd/yyyy')
)
)
Where
Id <> nvl(Id_Eliminate, -99999999999999)
/
or you could use
Select
Id
From
(
Select
Id,
Max(Id_Eliminate) Over (Partition By Id) Id_Eliminate
From
(
Select
Id,
Case When tc not in ('CB', 'CS', 'UT') Then
Id
End Id_Eliminate
From
table_t
Where
ocdate >= to_date('9/26/2006','mm/dd/yyyy') and
ocdate <= to_date('9/27/2007','mm/dd/yyyy')
)
)
Where
Id_Eliminate is null
Rgds
Abhay.
