mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1414 - Support dynamic aggregate formula without alias e.g. query.select("date, sum(totalKms), sum(hours)")
This commit is contained in:
@@ -79,11 +79,11 @@ public class TestAggregationTopLevel extends BaseTestCase {
|
||||
Query<DMachineStats> query = Ebean.find(DMachineStats.class)
|
||||
.select("date, sum(totalKms), sum(hours)")
|
||||
.where().gt("date", LocalDate.now().minusDays(10))
|
||||
.having().gt("hours", 2)
|
||||
.having().gt("sum(hours)", 2)
|
||||
.query();
|
||||
|
||||
List<DMachineStats> result = query.findList();
|
||||
assertThat(sqlOf(query)).contains("select t0.date, sum(t0.total_kms), sum(t0.hours) from d_machine_stats t0 where t0.date > ? group by t0.date having t0.hours > ?");
|
||||
assertThat(sqlOf(query)).contains("select t0.date, sum(t0.total_kms), sum(t0.hours) from d_machine_stats t0 where t0.date > ? group by t0.date having sum(t0.hours) > ?");
|
||||
assertThat(result).isNotEmpty();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user