 <p>You can aggregate (use <code>max</code> or <code>min</code> etc) in the same query.</p> <pre><code>select VisitIDCode ,MAX(CASE WHEN LeftJustifiedLabel = 'Additional Intervention Information' Then ValueText End) As 'Additional Intervention Information' ,MAX(CASE WHEN LeftJustifiedLabel = 'American Cancer Society Comment:' Then ValueText End) As 'American Cancer Society Comment:' ,MAX(CASE WHEN LeftJustifiedLabel = 'Intevention' Then ValueText End) As 'Intevention' From #AssessmentFS group by VisitIDCode </code></pre>