このクエリを作成しましたが、最後の date_attribution を見つける方法がわかりません
var usertmp = from user in entity.inv_utilisateur
join userbadgetmp in entity.inv_utilisateur_badge on user.u_id equals userbadgetmp.u_id into gj
from userbadge in gj.DefaultIfEmpty()
select new UserEJ
{
u_id = (int) user.u_id,
name = user.name,
date_attrib = userbadge.date_attribution // here I want find the last date
};
たとえば、この2つのテーブルがある場合:
inv_utilisateur inv_utilisateur_badge
u_id name u_id date_attribution
1 name1 1 20130911
1 20130807
2 name2 2 20120608
3 name3
結果が必要です
u_id name date_attribution
1 name1 20130911
2 name2 20120608
3 name3
編集 1
フィールドのタイプは次のとおりです: u_id : int、name : 文字列、date_attribution : datetime