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、セッションFROM msgs GROUP BYセッション」を実行する必要があります