What is the best way to get data only if attendance is 'C' and is a pass? I am getting data for C, E, W,X. for attendance column. Its mostly because of the duration type, H, D, W.
select t.LEARN_ID TRNG_ID
--when pt.DURATION_TYPE ='H' or pt.DURATION_TYPE ='D' or pt.DURATION_TYPE ='W' and pt.attendance = 'C' Then 'PASS'
when pt.DURATION_TYPE in('H' ,'D', 'W', '') and pt.attendance ='C' then 'PASS'--not in( 'I','E', 'N','W', 'X', 'S') Then 'PASS'
End as 'Completed Session'
from SESSN_TBL t
inner join TRAINING pt on pt.SESSION_ID =t.SESSION_ID