Channel stats query optimized. Problem: the lack of pivot and unpivot in MySql.