Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

GROUP BY IN LINQ

$
0
0

Hello,

I have the following LINQ query and what I am wanting to do is to group by the field, c.production_process_mon_data, so that all Monday's data is returned as a group figure. I just cannot work out how to do this. Could someone please assist?

          var total_produced = from c in context.production_process
                                 where c.product_component_id == SummaryData.component_id && c.incinerator_id == SummaryData.incinerator_id && c.dispatch_site_id == SummaryData.dispatch_site_id && c.production_process_week_number <= SummaryData.week_number && c.production_process_year == SummaryData.year
                                 group c by c.product_component_id into g
                                 select new { mon_data = g.Key.production_process_mon_data };

Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>