急救!!!求大神帮忙解决啊!!!
条件:
Levels:等级; Num:次数; No:排名;
DataTable dt = new DataTable();
dt.Columns.Add("Levels", typeof(string));
dt.Columns.Add("Num", typeof(string));
dt.Columns.Add("No", typeof(int));
DataRow dr1 = dt.NewRow();
dr1["Levels"] = "1";
dr1["Num"] = "7";
dt.Rows.Add(dr1);
dr1 = dt.NewRow();
dr1["Levels"] = "1";
dr1["Num"] = "5";
dt.Rows.Add(dr1);
dr1 = dt.NewRow();
dr1["Levels"] = "1";
dr1["Num"] = "3";
dt.Rows.Add(dr1);
dr1 = dt.NewRow();
dr1["Levels"] = "2";
dr1["Num"] = "6";
dt.Rows.Add(dr1);
dr1 = dt.NewRow();
dr1["Levels"] = "2";
dr1["Num"] = "4";
dt.Rows.Add(dr1);
dr1 = dt.NewRow();
dr1["Levels"] = "3";
dr1["Num"] = "0";
dt.Rows.Add(dr1);
dr1 = dt.NewRow();
dr1["Levels"] = "3";
dr1["Num"] = "9";
dr1 = dt.NewRow();
dr1["Levels"] = "3";
dr1["Num"] = "3";
dr1 = dt.NewRow();
dr1["Levels"] = "3";
dr1["Num"] = "4";
dt.Rows.Add(dr1);
问题 : 需要对dt进行同一等级下按次数进行排名,然后需要把排名的名次插入到dt当中
结果 : 排名 等级 次数
1 1 7
2 1 5
3 1 3
1 2 6
2 2 4
1&