是否可以通過使用延遲可執行的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