mardi 4 août 2015

make sum out of 5 columns using a select statement

I have the following columns with the afferent values:

p1 | p2 | p3 | p4 | p5
______________________
1    1    2    2    1
2    2    3    1    1

I would want to make a statement that let me sum up the columns depending on the number inside. example..

row1=sum of(p1,p2,p5) and sum of(p3,p4)
row=sum of(p1,p2) and sum of(p3) and sum of (p4,p5)

Aucun commentaire:

Enregistrer un commentaire