when use ’group by‘ ,the result is not expected
JiananHao opened this issue · 1 comments
JiananHao commented
table(id,f_name,s_name)
1,A, AA
2, B, BA
3, C, CA
4, A, AB
5, B, BB
6, C, CB
Dao.queryBuilder().where(new WhereCondition.StringCondition("f_name is not null group by f_name")).list()
the result is
4, A, AB
6, C, CB
5, B, BB
I expect the result
1,A, AA
2, B, BA
3, C, CA
JiananHao commented
SELECT MIN(_id) FROM * GROUP BY f_name
this sql can resolve the problem.
And I aways dont know the reason why ''Dao.queryBuilder().where(new WhereCondition.StringCondition("f_name is not null group by f_name")).list() '' result is unexpected