Good,
I have some difficulties in the result of a query. For you to fit it is as follows, I have a registration application of "unavailable." and I need the following:
Every day I have to extract a report from the previous day, however this report must have the following conditions:
-
Display all "outages" that are in the "Open" state. (Here I have to present)
-
Show all "unavailable" that have been opened on that day (eg 15/09/2014)
-
Show all "unavailable" that have been closed on that day (eg 15/09/2014), however at this point the following may happen:
An "unavailability" may have been closed yesterday (09/15/2014) but it was opened on (03/20/2014) but this point the query I have is working fine. My difficulty is occurring when one of the "outages" has not yet been closed and the "dataFim" field is null.
The queries I tried were:
var query = "SELECT * FROM indisponibilidades WHERE estadoIndisponibilidade = 'ABERTO' OR dataInicio = '" + dataPedido + "' OR dataFim = '" + dataFim + "' ";
This works but is also extracting results that have been entered today (09/16/2014) and what the dataFim field is at.
I also tried:
var query = "SELECT * FROM indisponibilidades WHERE estadoIndisponibilidade = 'ABERTO' OR dataInicio = '" + dataPedido + "' OR dataFim = '" + dataFim + "' dataFim is not null; ";
However it does me export also of all that have already been closed during the day today (09/16/2014).
Any ideas?