I am trying to develop a query that returns me a total value of requests from a given client, with an informed date range. For example, between 05/11/2015 and 05/12/2015.
The problem is that I need to make the exception for a few days between the reported dates. For example, let this query take the value between the dates given above, except on 11/14/2015 and 11/21/2015.
These days could not have the value of your orders added in the total amount.
What I was able 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 could not develop the dates part. Is there any way you can do this?
The tables are below
Customer table
CustomerID CustomerName
Order table
id Order CustomerID data requested totalValue