标签:from sel 返回 nbsp typeid int type new blog
真是醉了,前段时间摸索半天今天一写又忘了,特此写下来备忘,望大婶指点
from a in Table1
join b in Table2 on
a.Id equals b.Id2 into e from f in e.DefaultIfEmpty()
group new { a.Id1, a.Name, f.id2 } by new
{
a.Id,//一表的ID
a.Name,//一表的字段(Name)
f.id2//二表的字段(type)
} into c
select new Sontypes
{
TypeId = c.Key.Id,
TypeName = c.Key.Name,
TaltoNumber = c.Key.id2 == null ? 0 : c.Count()//这里判断二表有没数据,没有数据返回0,有数据返回总量
}
看来以后要多多记笔记了,尴尬
标签:from sel 返回 nbsp typeid int type new blog
原文地址:http://www.cnblogs.com/GetMoney/p/7156853.html