Skip to content
ginesr edited this page Sep 9, 2012 · 2 revisions

Sorting

One field

$record = Example::Country->find_all( name => 'arg', { order_by => 'iso' } );

Two fields

$record = Example::Country->find_all( name => 'arg', { order_by => [ 'iso', 'name' ] } );

One field desc

$record = Example::Country->find_all( name => 'arg', { order_by => { desc => 'name' } } );

Two fields both desc

$record = Example::Country->find_all( name => 'arg', { order_by => { desc => [ 'name', 'iso' ] } } );

Two fields one asc and second desc

$record = Example::Country->find_all( name => 'arg', { order_by => { asc => 'iso', desc => 'name' } } );

Three fields, two of them asc and one desc

$record = Example::Country->find_all( name => 'arg', { order_by => { asc => [ 'iso', 'name' ], desc => 'name' } } );

Explicit desc and asc

$record = Example::Country->find_all( name => 'arg', { order_by => [ { desc => 'name' }, { asc => [ 'iso', 'name' ] } ] } );

Clone this wiki locally