我在我的 android 应用程序中创建了一个 Sqlite 数据库,它看起来像这样:
create table msgs ( id integer primary key autoincrement, msg text not null, session text not null, sender text not null);
我可以得到所有这样的条目,但我不明白发生了什么。
String[] allColumns = {"msg","session","sender"};
Cursor cursor = database.query(msgs, allColumns, id = insertId, null, null, null, null);
我想做的是只获得具有不同会话的最新条目我如何在android中做到这一点?
编辑:如果这是 mysql,我会执行“SELECT MAX(id) AS id2,msg, session FROM msgs GROUP BY session”但是不能让它在 SQLite 中工作:/