我是Grails and Gorm的新人,因此我遇到了一个标准问题。想象一下,我有类似这样的查询:
with NAME as(select * from table1 where something = 'true')
select distinct table1.name ,table3.* from table2 T2
join table3 T3 on T2.some_id = T3.id
join NAME T1 on T3.some_t3_id = T1.id
join table4 T4 on T2.some_t2_id = T4.id
where T1.name in (select name from NAME)
如何将此查询转换为条件?
答案 0 :(得分:0)
如果您的查询是嵌套的,那么您可以使用exeuteQuery()或executeUpdate(),如下所示:
def domainObjectList = DomainClass.excuteQuery("select t1.name, t2.address from Student AS t1, Address AS t2")
//DomainClass here is Student
我认为这会对你有帮助!