java - Realm query for latest record for each user -
how accomplish similar query in realm java 1 asked in question: how query sql latest record date each user cause seems realm lacks group method when fetching queries
here's realmobject:
public class memo extends realmobject { @ignore public static final int sent = 1; @ignore public static final int unread = 2; @ignore public static final int read = 3; @ignore public static final int pending = 4; private static final string tag = memo.class.getname(); @primarykey public string id = ""; @index public string connection = ""; public string subject = ""; public string body = ""; public int status = 0; public date date; public boolean sentbyme = false; public string remoteid = ""; public boolean isfile = false; public string filepath = ""; }
this represents user:
public string connection
realmresults<memo> latestmemos = realm.where(memo.class) .findallsorted("date", sort.descending) .distinct("connection");
Comments
Post a Comment