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 = 1Now 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.