📜  按 ef core 分组 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:15.149000             🧑  作者: Mango

代码示例1
var query = 
    from ep in dbContext.tbl_EntryPoint
    join e in dbContext.tbl_Entry on ep.EID equals e.EID
    join t in dbContext.tbl_Title on e.TID equals t.TID
    where e.OwnerID == user.UID
    group new { ep, e, t } by new { e.aID, e.bCode, e.Date, e.FCode } into g
    let r = g.OrderByDescending(x => x.e.ID).FirstOrDefault()
    select new
    {
        UID = r.e.OwnerID,
        TID = r.e.TID,
        Title = r.t.Title,
        EID = r.e.EID
    };