MySQL Forums
Forum List  »  Spanish

Se puede simplificar esta instrucción?
Posted by: Felipe Arvizu
Date: February 28, 2020 12:28PM

Se puede simplificar esta instrucción?

select
(Select count(*) from clientes where Fecha > '2020-01-01' and Fecha< '2020-02-01')as Enero,
(Select count(*) from clientes where Fecha > '2020-02-01' and Fecha< '2020-03-01')as Febrero,
(Select count(*) from clientes where Fecha > '2020-03-01' and Fecha< '2020-04-01')as Marzo,
(Select count(*) from clientes where Fecha > '2020-04-01' and Fecha< '2020-05-01')as Abril,
(Select count(*) from clientes where Fecha > '2020-05-01' and Fecha< '2020-06-01')as Mayo,
(Select count(*) from clientes where Fecha > '2020-06-01' and Fecha< '2020-07-01')as Junio,
(Select count(*) from clientes where Fecha > '2020-07-01' and Fecha< '2020-08-01')as Julio,
(Select count(*) from clientes where Fecha > '2020-08-01' and Fecha< '2020-09-01')as Agosto,
(Select count(*) from clientes where Fecha > '2020-09-01' and Fecha< '2020-10-01')as Septiembre,
(Select count(*) from clientes where Fecha > '2020-10-01' and Fecha< '2020-11-01')as Octubre,
(Select count(*) from clientes where Fecha > '2020-11-01' and Fecha< '2020-12-01')as Noviembre,
(Select count(*) from clientes where Fecha > '2020-12-01' and Fecha< '2021-01-01')as Diciembre;

Lo que trato de hacer es ver cuantos clientes ingresaron en cada mes

Options: ReplyQuote


Subject
Views
Written By
Posted
Se puede simplificar esta instrucción?
548
February 28, 2020 12:28PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.