是否可以通过使用延迟可执行的LINQ-to-SQL查询表达式或方法链来生成以下SQL查询?如何在LINQ-to-SQL中生成SQL COUNT(*)OVER(PARTITION BY {ColumnName})?
数据结构
alt text http://www.freeimagehosting.net/uploads/e062a48837.jpg
Select Distinct ClassRoomTitle,
Count(*) Over(Partition By ClassRoomNo) As [No Sessions Per Room],
TeacherName,
Count(*) Over(Partition By ClassRoomNo, TeacherName) As [No Sessions Per Teacher] From ClassRoom
预期结果
alt text http://www.freeimagehosting.net/uploads/47a79fea8b.jpg
CN你所得到的数据的波斯坦例子吗? – Luiscencio 2010-06-23 21:44:33
我刚编辑以包含预期结果。 – 2010-06-24 01:50:19
只是编辑我的答案,以适应您的预期结果 – Luiscencio 2010-06-24 14:24:59