I have a table:
DataTable store_temp = new DataTable();
store_temp.Columns.Add("patn");
store_temp.Columns.Add("rf");
store_temp.Columns.Add("name");
store_temp.Columns.Add("conv");
store_temp.Columns.Add("conv_type");
store_temp.Columns.Add("recorddate");
store_temp.Columns.Add("executiondate");
My C# code :
int i = 0;
var rowsgroups = (from row in store_temp.AsEnumerable().GroupBy(row =>
row.Field<string>("patn"))
.OrderBy((g => g.OrderByDescending(y => y.Field<string("executiondate")).ThenByDescending(y =>
y.Field<string>("rf"))))
select new
{
patn = row.ElementAt(i),
rf_num = ++i,
}).ToArray();
I want the lambda experession, which is equivalent to:
select patn, rf,> row_number() over( partition by patn order by executiondate,rf ) as rf_num,
name, conv,conv_type, recorddate, executiondate from store_temp2
But, lambda syntax ... var rowsgroups has just a one row.. I want to show all rows in store_temp. What should I do to fix the query?
lamba .. sqldoes not' contain any group by .. it only required order-by for row_number.. did you miss there any thing??