I have a table with 16 columns: Id, Product_Id, Sunday, SundayCnt, Monday, MondayCnt,...,SaturdayCnt
As you can see there are weekday columns and weekday counting columns
I would like to average the values of every week day ONLY if the value at weekday counting column is bigger than ZERO
Example
Sunday=30 SundayCnt=0
Monday=27 MondayCnt=2
Tuesday=2 TuesdayCnt=0
Wednesday=75 WednesdayCnt=0
Thursday=2 ThursdayCnt=1
Friday=12 FridayCnt=0
Saturday=15 SaturdayCnt=22
for this example averge must take only (27+2+15)/3=14.66 because Cnt columns on those days are bigger than 0
Any idea on how to make this on a simple script