I need a help to translate a statement from LINQ to SQL
SQL
SELECT MONTH(ind_receita.lad_ins_date) as 'Month', SUM(ind_receita.valor) as Monthly_Value
FROM ind_receita
WHERE YEAR(ind_receita.lad_ins_date) = 2014
GROUP BY MONTH(ind_receita.lad_ins_date)
WITH ROLLUP
I know how to do all the statement in LINQ but I have some doubt with the WITH ROLLUP
LINQ
var query = (from p in _repositorio.GetReceitas()
where p.DataHoraCriacaoRegistro.Year == 2014
group p by new { p.DataHoraCriacaoRegistro.Month } into grp
select new ReceitaPorGrupoProduto
{
// Column with the alias 'Monthly_Value'
ValorReceita = grp.Sum(p => p.Valor)
// Column with the alias 'Month'
DataHora = grp.Key.Month
}).ToList();
But how can I put the WITH ROLLUP
in my LINQ
?
A Rollup will give me just a totalizer, so, if we can do it without making a ROLLUP statement for LINQ, it's ok.