select p2013+p2014 as s, 0 as sb from tabella where anno1='A' and anno2='A'
UNION
select 0 as s, p2014 as sb from tabella where anno1='B' or anno2='B'

ma non mi e' chiaro cosa tu intenda per "me li metta in una variabile"