我想订购一个数据库 - 但它不起作用
是
ORDER BY <Field> ASC
android的声明?
您不能“订购”数据库。但是,您可以使用适当的查询重载对查询结果进行排序。
public Cursor query (String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy)
例如:
db.query("someTable", new String[] { "ColumnA", "ColumnB" }, "WHERE ColumnC = ?",
new String[] { "ColumnC_Condition" }, "ColumnB", null, "ColumnA");
翻译成
SELECT ColumnA, ColumnB FROM someTable WHERE ColumnC = "ColumnC_Condition"
GROUP BY ColumnB ORDER BY ColumnA