Dynamic Linq for SQL MIN() function -


original sql looks like:

select min(id) geoid, min(postalcode), placename     geodata_all     group countrycode, placename     order placename 

i need translate in dynamic linq, like:

var searchresult = db.set(geodata)     .asqueryable()     .orderby("placename")     .groupby("countrycode", "placename")     .select("new (min(id) geoid, min(postalcode), placename"); 

unfortunately 'min' function doesn't seem applicable dynamic linq

following code can help, please check (this sample code only):

var searchresult = db.set(geodata)     .asqueryable()     .orderby("placename")     .groupby("countrycode", "placename")     .select(g => new { geoid = g.min(p => p.id), postalcode = g.min(p => p.postalcode), placename = g.placename }); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -