我有这个mysql查询
SELECT cr1.project_id
FROM contribution_request as cr1
INNER JOIN contribution_request as cr2 ON cr1.project_id = cr2.project_id
WHERE cr1.instrument_id = 5 AND cr2.instrument_id = 6
我需要通过grails createCriteria
function
我试过这个,但它不起作用,我找不到怎么做。
def pc = ContributionRequest.createCriteria();
def Object = pc.list {
projections {
property("project.id")
}
and {
eq "instrument.id", 5L
eq "instrument.id", 6L
}
}
感谢您的帮助
答案 0 :(得分:0)
当您使用- - "1234"
时,应使用projections
代替get
。您的代码如下所示:
list