var query = tA
.Where(a => a.cAuthorizedStatus == "Pending")
.Join(tB, a => a.nGroupCode, b => b.nGroupCode, (a, b) => new
{
cSubGroupName = a.cSubGroupName,
cAddedBy = a.cAddedBy,
dAddedOn = a.dAddedOn,
cGroupName = b.cGroupName
});
或者
var query = tA
.Join(tB, a => a.nGroupCode, b => b.nGroupCode, (a, b) => new
{
cSubGroupName = a.cSubGroupName,
cAddedBy = a.cAddedBy,
dAddedOn = a.dAddedOn,
cGroupName = b.cGroupName,
cAuthorizedStatus = a.cAuthorizedStatus
})
.Where(j => j.cAuthorizedStatus == "Pending")
.Select(j => new
{
cSubGroupName = j.cSubGroupName,
cAddedBy = j.cAddedBy,
dAddedOn = j.dAddedOn,
cGroupName = j.cGroupName
});
请注意,仅当您想明确排除cAuthorizedStatus
返回集中的列时,才需要最后一次选择。