My goal is to write a code order my table by "Currency". It will then using the string input of "User" and find that user after the Order By query. It will return the row number of that user which is basically the rank. Is this the most efficient way to do it? I found out I have to actually count each row which doesn't seem efficient. Thank you all in advance.
public string rank(string user)
{
String sql = "SELECT user FROM '" + channel + "' ORDER BY currency DESC LIMIT 10";
String rank = "";
using (cmd = new SQLiteCommand(sql, myDB))
{
using (SQLiteDataReader r = cmd.ExecuteReader())
{
///* Calculate the row number after order by *////
}
}
return rank;
}