1

Within my application I have an Entity / table that has a Name field (among several other fields). I want a list of Strings of all the unique names found in that table.

Right now the only thing I can think of is to load all the results into a list of entity objects, iterate over them, and store the names in a Set, and then convert this Set into a List.

It seems inefficient though. Does GreenDao support a feature like this natively or must all queries return Entity objects?

Pavya
  • 6,015
  • 4
  • 29
  • 42
KaliMa
  • 1,970
  • 6
  • 26
  • 51

1 Answers1

1

It doesn't support it natively. You'll have to use the rawQuery approach and pass either a DISTINCT or GROUP BY sql query.

Usage of rawQuery for this scenario has been answered here

Community
  • 1
  • 1
thudbutt
  • 1,481
  • 1
  • 19
  • 32