I want to show only the first ten records in my SQL database. At the moment, my code is as follows:
for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
result = result + c.getString(iRow) + " " + c.getString(iName) + " " + c.getString(iScore) + "\n";
}
So, this currently shows all entries into the database as !c.isAfterLast(); is stated. I couldn’t see how to specify which position you want to count to as they were getters and not simply querying where the cursor is pointing.
Any help would be appreiated,
Thanks!
You can use the Sqlite LIMIT keyword, for example:
SELECT * FROM
your_tableLIMIT 0, 10or
I hope it helps.