Skip to content

Instantly share code, notes, and snippets.

View CyborgHead's full-sized avatar

Amr Hisham CyborgHead

View GitHub Profile
@linuxbender
linuxbender / Linq - C
Created April 29, 2011 09:42
Linq and SQL - group max date - show latest entry - example
// http://creativecommons.org/licenses/by-nc-sa/3.0/
var foo = from p in _db.tblFactories
group p by p.tblFactoryName into grp
let tblFactoryExportDate = grp.Max(p => p.tblFactoryExportDate)
let tblFactoryName = grp.Key
from p in grp
where p.tblFactoryName == tblFactoryName &&
p.tblFactoryExportDate == tblFactoryExportDate