篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql Registro realizados divididoendíasdela semana相关的知识,希望对你有一定的参考价值。
SELECT
(SELECT SUM(quantity)
FROM `reseller_log`
WHERE type = 'CREATE' AND created_at BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 DAY ) AND CURDATE()) AS 'one',
(SELECT SUM(quantity)
FROM `reseller_log`
WHERE type = 'CREATE' AND created_at BETWEEN DATE_SUB(CURDATE(), INTERVAL 2 DAY ) AND CURDATE()) AS 'two',
(SELECT SUM(quantity)
FROM `reseller_log`
WHERE type = 'CREATE' AND created_at BETWEEN DATE_SUB(CURDATE(), INTERVAL 3 DAY ) AND CURDATE()) AS 'three',
(SELECT SUM(quantity)
FROM `reseller_log`
WHERE type = 'CREATE' AND created_at BETWEEN DATE_SUB(CURDATE(), INTERVAL 4 DAY ) AND CURDATE()) AS 'four',
(SELECT SUM(quantity)
FROM `reseller_log`
WHERE type = 'CREATE' AND created_at BETWEEN DATE_SUB(CURDATE(), INTERVAL 5 DAY ) AND CURDATE()) AS 'five',
(SELECT SUM(quantity)
FROM `reseller_log`
WHERE type = 'CREATE' AND created_at BETWEEN DATE_SUB(CURDATE(), INTERVAL 6 DAY ) AND CURDATE()) AS 'six',
(SELECT SUM(quantity)
FROM `reseller_log`
WHERE type = 'CREATE' AND created_at BETWEEN DATE_SUB(CURDATE(), INTERVAL 7 DAY ) AND CURDATE()) AS 'seven'
FROM `reseller_log`
GROUP by one
以上是关于sql Registro realizados divididoendíasdela semana的主要内容,如果未能解决你的问题,请参考以下文章