I'm trying to retrieve the records from the joined tables based on 2 condition like below:
Where if(b.enddate is null)
a.starttime >= b.starttime
else
a.starttime >= b.starttime and a.endtime <= b.endtime
I have seen examples using case when but the result is not what I wanted. Please assist me to convert this condition into a proper sql format.