I'm trying to retrieve the records from the joined tables based on 2 condition like below: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.