linq行列转化
SELECT t1.name ,
(SELECT COUNT(1) FROM temp t2 WHERE t2.NAME =t1.NAME AND t2.result='胜')AS '胜',
(SELECT COUNT(1) FROM temp t3 WHERE t3.NAME =t1.NAME AND t3.result='负')AS '负'
FROM
(SELECT NAME FROM temp GROUP BY NAME ) AS t1
这个怎么用linq实现
------解决方案--------------------var query=from t in Temps
group t by t.NAMEinto m
selectnew
{
NAME=m.Key,
胜=m.Count(n=>n.Result=="胜"),
负=m.Count(n=>n.Result=="负")
};
http://blog.csdn.net/q107770540/article/details/6270693
------解决方案--------------------var query=from t in Temps
group t by t.NAME into m
select new
{
NAME=m.Key,
胜=m.Count(n=>n.Result=="胜"),
负=m.Count(n=>n.Result=="负")
};