c# - Group By using Select statement in Linq -
var query = in sfc.supplies_receivetrans orderby i.poprctnm descending select new { rr = i.poprctnm };
result:
rr-01, rr-01, rr-02, rr-02, rr-02, rr-test, rr-test,
how group rr in kind of statement
result:
rr-01, rr-02, rr-test
just few modification ask if possible 1 or have in mind? sorry asking interested in learning more on linq.. how convert string coz showing true or false.. boolean statement
var query = sfc.supplies_receivetrans.select(s => s.poprctnm.startswith(p)) .distinct() .orderby(p => p) .select(p => new { rr = p }) .take(10);
you can use distinct
or groupby
methods in case
var query = sfc.supplies_receivetrans.select(s=> s.poprctnm) .distinct() .orderbydescending(p => p) .select(p=> new { rr = p });
if use orderbydescending
result
rr-test rr-02 rr-01
but think want orderby
result
rr-01 rr-02 rr-test
so try below
var query = sfc.supplies_receivetrans.select(s=> s.poprctnm) .distinct() .orderby(p => p) .select(p=> new { rr = p });
Comments
Post a Comment