こんな感じでしょうか。
http://ideone.com/couziu
using System;
using System.Collections.Generic;
using System.Linq;
namespace Teratail47399
{
class Program
{
class SampleTable
{
public long Id;
public string User;
public DateTime LoginDate;
}
static void Main(string[] args)
{
var list = new List<SampleTable>();
list.Add(new SampleTable()
{
Id = 0,
User = "user01",
LoginDate = DateTime.Parse("2016/08/09 13:00")
});
list.Add(new SampleTable()
{
Id = 1,
User = "user01",
LoginDate = DateTime.Parse("2016/09/09 13:00")
});
list.Add(new SampleTable()
{
Id = 2,
User = "user01",
LoginDate = DateTime.Parse("2016/09/10 13:00")
});
list.Add(new SampleTable()
{
Id = 3,
User = "user02",
LoginDate = DateTime.Parse("2016/09/10 13:00")
});
foreach (var data in list.Where(x => x.User == "user01").GroupBy(x => x.LoginDate.ToString("yyyy/MM")))
{
Console.WriteLine($"{data.Key} {data.Count()}回");
}
}
}
}
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/09/09 08:19
2016/09/09 08:42 編集
2016/09/09 09:08