My original table is like that: ID A1 A2 A3 cnt 1234 1 0 0 4 1234 1 0 1 8 1234 1 1 1 5 1235 1 0 0 6 1235 1 0 1 7 1235 1 1 1 12 I have to create a new table B: ID B1 B2 B3 S 1234 4 8 5 17 1235 6 7 12 25 The combination (A1=1,A2=0,A3=0) gives B1 The combination (A1=1,A2=0,A3=0) gives B2 The combination (A1=1,A2=1,A3=1) gives B3 S = B1+B2+B3 I think it's a classical problem, but i can't see to problem key Thx, Lhaj