I have a query turns out that I have to do a filter joining two tables with lambda, is the expression with only one but how do I do it with two?
this is my SQL Query
declare @Cod_Empresa int
set @Cod_Empresa = 9
select
Margen.Codigo_Medidor, Margen.Fecha, Margen.Codigo_barra, Margen.Total_Balance
from tb_margen_operativo_cierre Margen, tb_medidor Medi
where Margen.Codigo_medidor = Medi.Codigo_Medidor
and Medi.Codigo_empresa = @Cod_Empresa
This is my C# Code
int codigoempresa = 9
var margen = cm.tb_margen_operativo_cierre. //I need 2 tables tb_margen_operativo_cierre and tb_medidor
Where(x => x.Fecha <= fin && x.Fecha >= inicio).
GroupBy(r => r.Fecha).
Select(v => new
{
Total_Balance = v.Sum(x => x.Total_Balance),
}).AsEnumerable().Select(x => new tb_margen_operativo_cierre
{
Total_Balance = x.Total_Balance,
}).ToArray();
for (int i = 0; i < margen.Length; i++)
{
valormes = valormes + margen[i].Total_Balance;
valorgraficodiario[i] = margen[i].Total_Balance;
}
How do it? thanks