``` `DataContex db = new DataContex(); var query = ( from v1 in db.View1 where shf.Date >= dpDate.Value && shf.Date <= dpDate1.Value select new { v1.Name, v1.Date, v1.Quality, v1.Rat, v1.Total } ).Concat ( from v2 in db.View2 where f.Date >= dpDate.Value && f.Date <= dpDate1.Value select new { v2.Name, v2.Date, v2.Quality, v2.Rat, v2.Total } ).Concat (from View2 in (from v2 in db.View2 where v2.Date >= dpDate.Value && sh.Date <= dpDate1.Value select new { v2.Name, v2.Date, v2.Quality, v2.Rate, v2.Total }) group v2 by new { v2.NRFA } into g select new { Name = "Total:", Date = dpDate1.Value, Quality = (decimal?)g.Sum(p => p.Quality), Rate = (decimal?)g.Sum(p => p.Rate), Total = (decimal?)g.Sum(p => p.Total) } );` 块引用
2条答案
按热度按时间rbl8hiat1#
在林肯
UNION ALL
是.Concat()
,所以:你一定要记住
test1
以及test2
必须是类型MyModel
以及MyModel
仅包含columnA
,columnB
以及columnC
.k7fdbhmy2#
我把两个表放在一个datagridvie中,但是在datagridview的最后一行,我需要全国两个表的总数,我可以为一个表总计一行,为另一个表总计一行,我也不需要,就像我只能有一行两个表的总数一样。