var editorLastArticle = from article in DAO.context.GetTable()
group article by article.M_RefKoseYazariId
into g
let lastArticleDate = g.Max(x => x.M_KayitTarihi)
select new
{
Editor = g.Key,
LastArticleDate = lastArticleDate
};
var query = from article in DAO.context.GetTable()
join eal in editorLastArticle
on
new
{
article.M_RefKoseYazariId,
article.M_KayitTarihi
}
equals
new
{
M_RefKoseYazariId = eal.Editor,
M_KayitTarihi = eal.LastArticleDate
}
select new
{
article.M_YaziId,
article.M_Baslik,
article.M_Icerik,
article.M_RefKoseYazariId
};
SELECT [t0].[yazi_id] AS [M_YaziId], [t0].[baslik] AS [M_Baslik], [t0].[icerik] AS [M_Icerik], [t0].[refKoseYazari_id] AS [M_RefKoseYazariId]
FROM [Yazilar] AS [t0]
INNER JOIN (
SELECT MAX([t1].[kayitTarihi]) AS [value], [t1].[refKoseYazari_id]
FROM [Yazilar] AS [t1]
GROUP BY [t1].[refKoseYazari_id]
) AS [t2] ON ([t0].[refKoseYazari_id] = [t2].[refKoseYazari_id]) AND ([t0].[kayitTarihi] = [t2].[value])
JOIN ile ilgili güzel bir anlatımda Oğuz Yağmur'dan.