Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to use window functions in where clause without inline view

515746May 16 2013 — edited May 17 2013
Hi,

Below is the query where I need to filter the data using window function.

I don't want to use inline view for mt query because i need to use the same query in OWB which it wont support.
Select a.Physical_Id,
       a.Booking_Begin_Date,
       a.Booking_End_Date,
       a.Country_Cd,
       Row_Number() Over(Partition By a.Physical_Id, a.Country_Cd, a.Booking_Begin_Date Order By a.Booking_Begin_Date) Rnk                           
                             From booking_mstr a
                            Where Row_Number() Over(Partition By a.Physical_Id, a.Country_Cd, a.Booking_Begin_Date Order By a.Booking_Begin_Date) =1;

I Cannot use below query in OWB Which is Inline View
----------------------------------------------------------------------------

Select b.* From 
(Select a.Physical_Id,
       a.Booking_Begin_Date,
       a.Booking_End_Date,
       a.Country_Cd,
       Row_Number() Over(Partition By a.Physical_Id, a.Country_Cd, a.Booking_Begin_Date Order By a.Booking_Begin_Date) Rnk                           
                             From booking_mstr a) Where b.rnk=1;
;

Any help really appreciated.

Thanks in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 14 2013
Added on May 16 2013
4 comments
1,350 views