Reputation: 2564
I'm getting a list of the data that I have stored in my column 'age'. What I want to do is to do an order by desc, but I have no idea how I can do it.
My code:
def c = Config.createCriteria()
def checkAge = c.list {
projections {
property('age')
}
}
Upvotes: 1
Views: 1144
Reputation: 50265
def c = Config.createCriteria()
def checkAge = c.list {
projections {
property('age')
}
order 'age', 'desc'
}
Refer createCriteria for details.
Upvotes: 4
Reputation: 101
You can do this with a parameter to your call to list:
c.list(order: 'desc') { ... }
See The Grails Guide for more details.
Upvotes: 0