我有一个 CAR 实体,其 BRAND 属性用long
.
我想知道表中有多少不同的品牌。
使用 SqlLite/GreenDAO 我可以使用
SELECT COUNT (DISTINCT column) FROM tablename
有了 ObjectBox,我来到了
long[] ids = App.shBox.query().build().property(Car_.companyId).distinct().findLongs();
数组的长度是我的结果。
有没有更好的方法来获得相同的结果?
我希望使用
App.shBox.query().build().property(Car_.companyId).distinct().count();
但这是不可能的。