我像这样在我的 SQLite 数据库中获取记录。
spellId = extra.getString("spellId");
DBase db = new DBase(this);
db.open();
String[] data = db.getRecord(Integer.parseInt(spellId));
db.close();
我可以在不使用原始查询和游标的情况下获取这样的随机数据吗?
最佳答案
像这样尝试:
db.rawQuery("SELECT * FROM mainTable ORDER BY RANDOM() LIMIT 1", null);
关于android - 在 SQLite 中获取随机记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28249169/