摘要:
/**************OrderBy ,Groupby练习*******************/ //按学生的总分数按降序排列排序 var list = from s in ctx.T_Student join c in ctx.T_Score on s.stuNumber equals c.stuNumber into temp from t in temp orderby temp.Sum(k => k.score) descending select new { stuName = s.stuName, scoreSum = temp.Sum(k=>k.score) 阅读全文
摘要:
/**************join 练习*******************/ //对于1对多关系 var list =from c in ctx.T_Student from s in c.T_Score where c.stuName=="黄阳" select s; //也可以间接的通过表关联其它表,这个结果和上边的查询结果相同 var list1 = from s in ctx.T_Score where s.T_Student.stuName=="黄阳" select s; //多对多关系,他们之间的关系是1:M:1 var list2 = 阅读全文