I need equivalent LINQ to SQL query for the query written in access database. Below is the query in access database.
SELECT Table1.ID, Table1.CODE, MIN (Table1.COST)
FROM Table1 GROUP BY Table1.ID, Table1.CODE
In this query I get COST which is minimum to the given repeated CODE
Below query is giving error "Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access."
var ptQ = from i in
(from uh in ptTable
select new
{
uh.ID, uh.CODE, uh.COST
})
group i by new { i.ID, i.CODE }
into g
select new
{
g.Key.ID, g.Key.CODE, g.Min(uh => uh.COST)
};