select id, (a*64)+(b*32)+(c*16)+(d*8)+(e*4)+(f*2)+(g*1)
from test
this number you can reverse it to convert to a 7 digit binary code.
examples:
18 = 0010010 , 1000000 = 64
3
solved How to select a column names of a table in mysql based on the value it contains