select F.col1, F.col2,
case when F.col3 = 1 Then XXX Else YYY End AS P
from table F
left join (select T.col3 , T.m, T.n
from tableT T
) as SecondTable ON secondTable.col3 = F.P
where ....
please note I need to compare the resultset of P (and not the F.Col3) against the T.col3
Our community of experts have been thoroughly vetted for their expertise and industry experience.