Is it possible to do an "in" criteria using the GORM criteria. I'm looking for the equivalent of the following SQL
select * from Person where age in (20,21,22);
If it was possible I guess the syntax would be something like:
def results = Person.withCriteria {
in "age", [20, 21, 22]
}
The Grails createCriteria documentation includes an example of using the
in
clause:The documentation includes this note:
Yep, you have it almost exactly right. Just change
in
to'in'
, sincein
is a keyword in groovy.