score:1

Accepted answer

your sql query can be translated to this linq query:

var query =(from t in context.titles
            join td in context.titledetails on t.id equals td.titleid into tds
            from e in tds.defaultifempty()
            where e.orderdate!=null
            group  e.orderdate by new {t.name, t.limpisbn, t.casedisbn} into groups
            from g in groups
            select new { name = m.key.name,
                        limpisbn = g.key.limpisbn,
                        casedisbn = g.key.casedisbm,
                        lastorder = g.max(x => x)})
            .orderby(e=>e.lastorder).take(5);

score:1

almost like that

var last5item = from td in context.titledetails.orderbydescending(i => i.orderdate).take(5)
                join t in context.titles on td.titleid equals t.id
                select ..

Related Query

More Query from same tag