Hey Friends
Here is the table details and data
id data h1 h2 h3 h4 h5 h6 h7 h8
1 2010-10-10 1 1 1 1 1 1 1 1
1 2010-10-11 1 0 1 0 1 0 0 1
1 2010-10-12 0 1 1 1 1 0 0 0
what i need to know is how can i create query for following
- find total no of zero in h1-h8 for id 1
- find total no of one in h1-h8 for id 1
- find total of data in h1-h8 for id1(total no of zero+total no of one)
- after getting 1,2,3 use the following answer in the equation (val(3)-val(1))/val(3)
i am not that much good in mysql, if you guys can help me then it will be a great help,thks in advance
First of all, it seems like answer to 3. will be 8*number of rows, but…
answer 1:
answer 2:
answer 3:
and answer 4:
figure it out yourself, you should have enough to start your journey now 🙂