Sqlite3获取选择限制值C ++

时间:2017-02-04 00:16:11

标签: c++ mysql sqlite

我正在使用sqlite3。

现在我从表中选择前5条记录。  像那样:

int Main()
{
    sqlite3 * db;
    sqlite3_stmt * stmt;
    sqlite3_prepare(db, "SELECT * FROM [PLAYERLEVEL] ORDER BY [Level] Desc LIMIT 5;", -1, &stmt, NULL);
    sqlite3_step(stmt);
    int GetLevel = sqlite3_column_int(stmt, 1);
    return GetLevel;
}

现在GetLevel变量只获得存储在PLAYERLEVEL表中的第一个最高记录,如何在使用LIMIT 5时获得我想要的所有值。

Example:
Top record Level = 88.
2nd Highest record level = 87.
3rd Highest record level = 82.
How can I get 87? and how can I get 82?

谢谢

0 个答案:

没有答案