var sectionBasin = (from s in section
join b in standard
on s.SectionCode equals b.SectionCode
select new
{
SectionCode = s.SectionCode,
Province = s.Province,
Standard = b.Standard
}) .GroupBy(x => x.Province).Select(t => new
{
code = t.Key,
upStd = t.Where(x => x.Standard == 0).Count(),
subStd = t.Where(x => x.Standard == 1).Count(),
join b in standard
on s.SectionCode equals b.SectionCode
select new
{
SectionCode = s.SectionCode,
Province = s.Province,
Standard = b.Standard
}) .GroupBy(x => x.Province).Select(t => new
{
code = t.Key,
upStd = t.Where(x => x.Standard == 0).Count(),
subStd = t.Where(x => x.Standard == 1).Count(),