Grails groupProperty和命令。怎么运行的? [英] Grails groupProperty and order. How it works?

查看:156
本文介绍了Grails groupProperty和命令。怎么运行的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个域:

I have this domain :

class Participation {
   ParticipationStatus status
}
class ParticipationStatus{
   String name
   Date creationDate
}

I创建一个查询:

I create a query :

Participation.createCriteria().list{
   createAlias("status","statusAlias")
   order "statusAlias.creationDate"
   projections{
     groupProperty "id"    
   }
}

但我收到一个错误:
导致:java.sql.SQLException:ORA-00979:没有表达式GROUP BY

But I received an error : Caused by: java.sql.SQLException: ORA-00979: N'est pas une expression GROUP BY

我在2天前在这个查询grrrr上工作! ; - )

I 'm working 2 days ago on this query grrrr ! ;-)

非常感谢

Thanks a lot

推荐答案

在聚合查询中(使用 projection )的查询应该是 groupProperty ,或者只有一个聚合函数参数(即,无论如何都在预测中)。
在此示例中,请尝试

Every field you use in aggregate queries (the one using projections) should be either a groupProperty, or only an aggregate function argument (that is, in projections anyway). In this example, try

Participation.createCriteria().list{
   createAlias("status","statusAlias")
   order "statusAlias.creationDate"
   projections{
     groupProperty "id"    
     groupProperty "statusAlias.creationDate"
   }
}

这篇关于Grails groupProperty和命令。怎么运行的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆