8,497
社区成员
发帖
与我相关
我的任务
分享
select a.* ,c.Class_name from
(
select a.NickName,b.* from UserTb a
left join SpecialTreatmentTb b on a.userid=b.userid
) a
left join GoodsTb c on a.goodid=c.id
var items = from a in db.UserTb join b in db. SpecialTreatmentTb
on a.userid equals b.userid select new { a.NickName, b};
var res = from a in items join b in db.GoodsTb on a.goodid equals b.id select new {a,b.classname};
没有在编译器中跑,只是为了给楼主一个思路,希望对楼主有用select a.* ,c.Class_name from
(
select a.NickName,b.* from UserTb a
left join SpecialTreatmentTb b on a.userid=b.userid
) a
left join GoodsTb c on a.goodid=c.id
ClassName = z.Class_Name == null ? "" : z.Class_Name,
FeeRate = a.FeeRate == null ? 0 : a.FeeRate,
BailRate = a.BailRate == null ? 0 : a.BailRate,
SellBailRate = a.SellBailRate == null ? 0 : a.SellBailRate,
SellFeeRate = a.SellFeeRate == null ? 0 : a.SellFeeRate,
var lowNums =
from a in SpecialTreatmentInfoLsit
join b in uInfoList on a.UserId equals b.UserId
into c
from d in c.DefaultIfEmpty()
join x in GinfoList on a.GoodId equals x.ID.ToString()
into y
from z in y.DefaultIfEmpty()
select new
{
d.UserId,
d.NickName,
d.Address,
ClassName =z==null?"": z.Class_Name,
FeeRate = a == null ? 0 : a.FeeRate,
BailRate = a == null ? 0 : a.BailRate,
SellBailRate = a == null ? 0 : a.SellBailRate,
SellFeeRate = a == null ? 0 : a.SellFeeRate,
};
都判断了, 不过调试还是提示 未引用对象实例化。。。var lowNums =
(from a in SpecialTreatmentTb
join b in UserTb on a.userid equals b.userid
into c
from d in c.DefaultIfEmpty()
join x in GoodsTb on a.id equals x.goodid
into y
from z in y.DefaultIfEmpty()
select new
{
d.NickName,
z.Class_name,
a.xx//(SpecialTreatmentTb以下查这个表里面的数据)
});
var lowNums =
(from a in SpecialTreatmentInfoLsit
join b in uInfoList on a.UserId equals b.UserId
into c
from d in c.DefaultIfEmpty()
join x in GinfoList on a.GoodId equals x.ID
into y
from endStords in y.DefaultIfEmpty()
select new
{
d.UserId,
d.NickName,
d.Address,
FeeRate = endStords == null ? 0 : endStords.FeeRate,
BailRate = endStords == null ? 0 : endStords.BailRate,
SellBailRate = endStords == null ? 0 : endStords.SellBailRate,
SellFeeRate = endStords == null ? 0 : endStords.SellFeeRate
});