Desctop',
MAX(IF(order_date = week(date_sub(curdate(), INTERVAL 1 WEEK)) , order_count, 0)) as '30.07.2018',
MAX(IF(order_date = week(date_sub(curdate(), INTERVAL 2 WEEK)) , order_count, 0)) as '23.07.2018',
MAX(IF(order_date = week(date_sub(curdate(), INTERVAL 3 WEEK)) , order_count, 0)) as '16.07.2018',
MAX(IF(order_date = week(date_sub(curdate(), INTERVAL 4 WEEK)) , order_count, 0)) as '09.07.2018',
MAX(IF(order_date = week(date_sub(curdate(), INTERVAL 5 WEEK)) , order_count, 0)) as '02.07.2018',
MAX(IF(order_date = week(date_sub(curdate(), INTERVAL 6 WEEK)) , order_count, 0)) as '25.06.2018',
MAX(IF(order_date = week(date_sub(curdate(), INTERVAL 7 WEEK)) , order_count, 0)) as '18.06.2018',
MAX(IF(order_date = week(date_sub(curdate(), INTERVAL 8 WEEK)) , order_count, 0)) as '11.06.2018',
MAX(IF(order_date = week(date_sub(curdate(), INTERVAL 9 WEEK)) , order_count, 0)) as '04.06.2018',
MAX(IF(order_date = week(date_sub(curdate(), INTERVAL 10 WEEK)), order_count, 0)) as '28.05.2018',
MAX(IF(order_date = week(date_sub(curdate(), INTERVAL 11 WEEK)), order_count, 0)) as '21.05.2018',
MAX(IF(order_date = week(date_sub(curdate(), INTERVAL 12 WEEK)), order_count, 0)) as '14.05.2018',
MAX(IF(order_date = week(date_sub(curdate(), INTERVAL 13 WEEK)), order_count, 0)) as '07.05.2018',
MAX(IF(order_date = week(date_sub(curdate(), INTERVAL 14 WEEK)), order_count, 0)) as '30.04.2018'
FROM orders_desktop
GROUP BY city;
Делай на клиенте
Обсуждают сегодня