sql Registro realizados divididoendíasdela semana

Posted

tags:

篇首语:本文由小常识网(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的主要内容,如果未能解决你的问题,请参考以下文章

sql Adicióndecolumnas para registro de nombre y puesto de responsable de firmar certificados

sql Insercióndesección“Iniciodesessión”en Cat_Bitacora Secciones para registro de ini

markdown Configurar Registro MX en otro servidor

php datos del objeto actual instancia registro(PHP)

ruby Registro base de datos(fechapecífica)查询Rails。

php Añadirunmensaje encima del formulario de registro y登录