Case can be used in the Select to translate the output to something else…

Select

P.PID

,P.Column1

,’D1′ As [Description]

,P.Column2

,P.Column3

,L.Column1

,L.Column2 As [Date]

,M.Column1

,M.Column2

,Case

When P.Column4 = 1 Then ‘Objective 1’

When P.Column4 = 2 Then ‘Objective 2’

When P.Column4 = 3 Then ‘Objective 3 – Doing Now’

Else ”

End As [Return Reason]

From TableP P

Inner Join TableL L On P.PID = L.PID

Left Outer Join TableM M On L.LID = M.LID And M.GroupID In (77, 88)

Where P.IsTrue = 1

Advertisements