Lets say you have a DataTable that has columns of "id", "cost", "qty":
DataTable dt = new DataTable();
dt.Columns.Add("id", typeof(int));
dt.Columns.Add("cost", typeof(double));
dt.Columns.Add("qty", typeof(int));
And it's keyed on "id":
dt.PrimaryKey = new DataColumn[1] { dt.Columns["id"] };
Now what we are interested in is the cost per quantity. So, in other words if you had a row of:
id | cost | qty
----------------
42 | 10.00 | 2
The cost per quantity is 5.00.
My question then is, given the preceeding table, assume it's constructed with many thousands of rows, and you're interested in the top 3 cost per quantity rows. The information needed is the id, cost per quantity. You cannot use LINQ.
In SQL it would be trivial; how BEST (most efficiently) would you accomplish it in C# without LINQ?
Update: Seeking answers that do not modify the table.