1
I have the following SQL
SELECT
dt_finished::date AS "DataFinalizacao",
count(DISTINCT tba.id_batches) AS "Quantidade Total"
FROM tb_batches AS tba
INNER JOIN tb_routes tro ON (tro.fk_id_products = tba.fk_id_products
AND tro.fk_id_sessions = 70
AND tba.finished = TRUE)
WHERE tba.dt_finished::date <= now()::date
AND tba.dt_finished::date >= (now() - INTERVAL '15 day')::date
GROUP BY tba.dt_finished::date
ORDER BY tba.dt_finished::date DESC
I need to return every day they’ve had batch
completed, if there is no batch
finished that day should bring the day only with the total amount zeroed.
The problem is he’s not bringing the date.
How to treat this in C# or in SQL?
My class
public class TaxaProducaoBLL : ITaxaProducaoBLL
{
public IEnumerable<TaxaProducaoOV> CalcularTaxaProducao(IEnumerable<TaxaProducaoOV> taxaProducao)
{
foreach (var taxa in taxaProducao)
{
}
return new List<TaxaProducaoOV>();
}
}
The scheme is that the following, there is nothing save this date missing in the bank, I have to check in the period of the select dates if there are missing dates , and put these dates ... I do not know if I understand well...
– Marcus Daniel
ah understood, this is more complex you would have to have an auxiliary table of dates, for the first query to be in it then. this way it only takes the records that exist in the table
– arllondias
Got it, I think q using an auxiliary table would be better msm :D
– Marcus Daniel