select uc.adminid, count(*)
from Users uc
join UsersMessage ucm on uc.admincallid = ucm.admincallid
where uc.CallDate between '2016-08-01' and '2016-09-01' and ucm.type = 4
group by uc.adminid
order by count(*)
をカウントし、ここで私が試したものです:LINQグループによると
public static Dictionary<int, int> ReturnSomething(int month)
{
Dictionary<int, int> dict = new Dictionary<int, int>();
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
LinqMetaData meta = new LinqMetaData(adapter);
dict = (from uc in meta.Users
join ucm in meta.meta.UsersMessage on uc.AdminCallId equals ucm.AdminCallId
where ucm.type == 4 && uc.CallDate.Month == month
group uc by uc.AdminId into g
select new { /* ???? adminid = g. */ }).ToDictionary(x => new Dictionary<int, int>(/* ????? x, x.Name*/));
}
return dict;
}
どのように私は私が必要なものを達成することができますか?
*どのように私は*私は必要なものを達成し、あなたの必要性は何ができますか?? –
私のSQLクエリが返すものを返すには、 –
に 'g.Key'と' g.Count() 'が必要です。 [この質問](http://stackoverflow.com/questions/7285714/linq-with-groupby-and-count)を見てください。 –