andy dev
andy dev

Reputation: 41

How to perform groupby in realm

Is there any method to group based on attribute I tried using realmresult.beginGroup(); and endgroup how to perform the fuction

    persons.beginGroup();
   for (int i = 0; i < value.size(); i++) {
            if (i > 0) {
                persons.or();
            }
            persons.equalTo(key, value.get(i));
        }
        persons.endGroup();

Upvotes: 4

Views: 5539

Answers (1)

Christian Melchior
Christian Melchior

Reputation: 20126

No, Realm doesn't support the equivalent of SQL GROUP yet. It is being tracked here: https://github.com/realm/realm-java/issues/2309

Right now you unfortunately have to do that manually.

Upvotes: 1

Related Questions