In this post we will see some more Lambda Expression Queries:
6. Order By Descending
var result = dbcontext.table_name.OrderByDescending(x => x.columnName).Take(1);
7. Order By Multiple Columns
var result = dbcontext.table_name.OrderBy(X => X.columnName).OrderBy(X => X.ColumnName);
8. Lesser than and equal to query
var result =dbcontext.table_namet.Where(x => x.columnname <= 4);
9. Joins
var result = bcontext.table_name.Join(dbcontext.table_name1,x=>x.column(table_name),y=>y.column(table_name1),(x,y)=> new{y.columnName,y.columnName,x.columnName}).ToList();
9. Joins
var result = bcontext.table_name.Join(dbcontext.table_name1,x=>x.column(table_name),y=>y.column(table_name1),(x,y)=> new{y.columnName,y.columnName,x.columnName}).ToList();
No comments:
Post a Comment