1
I’m trying to develop a query that will return me a total order value for a particular customer, with an informed date range. For example, between 05/11/2015 to 05/12/2015.
The problem is that I need to make the exception of a few days between the informed dates. For example, that this query takes the value between the dates reported above, except the days 14/11/2015 and the days 21/11/2015.
Those days could not have the value of your orders added in the total amount.
What I managed to do was this:
select sum(p.totalValor), c.nomeCliente
from Pedido p join Cliente c
on c.idCliente = p.idCliente
where p.dataPedido = /*filtro das datas*/
and idCliente = 2
I couldn’t develop the dates part. Is there any way to do this?
The tables are below
client table
idClient Nomecliente
order table
idPedido idClient dated totalValor