>Hi everybody,
>
>I have this inner select (used to join with other tables):
>
>
>select ;
>NVL(EQS.tScheduled_Time, <<m.lcFutureDate>>) ;
> as tScheduled_Time, TEQ.tExpire_date, ;
>TEQ.cTrans_Employees_Queues_Pk, ;
>TEQ.cTrans_fk from Trans_Employees_Queues TEQ ;
>LEFT JOIN Employee_Queue_Schedules EQS ON ;
>TEQ.cTrans_Employees_Queues_pk = ;
>EQS.cTrans_Employees_Queues_fk ;
>and EQS.iActive_Flag = 1 ;
>where TEQ.cCommission_Owner_UsGrLink_fk IS NULL ;
>and TEQ.cQueue_names_fk = '<<m.tcQueuePk>>' ;
>and TEQ.iActive_Flag = 1
>
>Now I want to add an additional filter for EQS.tScheduled_Time. If it's not empty, it should be less or equal tdAssignDate. My question is how should I write this additional filter. As you see, I use
>
>NVL(EQS.tScheduled_Time, <<m.lcFutureDate>>) ;
> as tScheduled_Time, TEQ.tExpire_date, ;
>
>
>
>I may not have records in EQS. If I do have records, they do have tScheduled_Time and I want this time to be less than passed date, e.g. if I have record scheduled in 45 days, I don't want it to be assigned today.
>
>So, what do you think I should do? Should I try to use step1 results (this select used as an inner select and called step1). I would not have an index on the date then...
>
>What do you think?
>
>Thanks a lot in advance.
This would work:
(EQS.tScheduled_Time is NULL or EQS.tScheduled_Time < <<m.lcAssignDate>>))
but I'm not sure this code is efficient.
If it's not broken, fix it until it is.
My Blog