I am working on a meter processing system.
I want to create an output where the system displays all the counters belonging to the client, and for each counter, the last three readings.
So far I have to stick with the code:
var lastMeterReading = from meeters in metermodel.Meeters
join reading in metermodel.Readings on meeters.MeterNumber equals reading.MeterNumber
where (maalers.CustNo == 6085574)
orderby reading.Date descending
group meeters by new { meeters.MeterNumber, reading.Consumption, reading.Date } into result
select new
{
Consumption = result.Key.Consumption, No = result.Key.MeterNumber, Date = result.Key.Date
};
Now it shows all the counters belonging to the client. If I put .take (3), it only displays the first 3 results.
thank! Daniel
Knaks source
share