日期:2014-05-20 浏览次数:20731 次
var ay=new int[]{6,7,8};
var query=from t1 in Table1
join t2 in Table2.Where(s=>ay.Contains(s.Month))
on t1.Name equals t2.Name into t
from t2 in t.DefaultIfEmpty()
from x in ay
orderby t2.Name,t2.Month
select new Table2
{
Name=t1.Name,
Month=x,
Score=t2==null?"NA":t2.Score
};
class CJoin
{
class T
{
public string Name { get; set; }
public int Month { get; set; }
public string Score { get; set; }