How to order by more than one field in Grails?

前端 未结 10 1971
萌比男神i
萌比男神i 2020-12-13 09:03

Is there a way to get a list ordered by two fields, say last and first names?

I know .listOrderByLastAndFirst and .list(sort:\'last, first\')

10条回答
  •  臣服心动
    2020-12-13 09:27

    This query is working on the basis of first field. When the first field is blank then it is shorted by the second field.

    order('last','desc')
    order('first','desc')
    

提交回复
热议问题