CREATE TABLE `table1` (
`id` char(15) NOT NULL,
`label` char(255) default NULL,
`group` char(255) default NULL,
PRIMARY KEY (`id`)
)
####
sub test_distinct :Local {
$c->stash->{distinct_groups} = [
$c->model('Database1')->resultset('Table1')->search(
undef,
{
select => [
{
distinct => 'group'
},
],
order_by => 'group'
},
)
];
}
####
[% FOREACH item IN distinct_groups %]
'[% item %]'
[% END %]
####
'TestApp::Schema::Database1::Table1=HASH(0x34a21a4)'
'TestApp::Schema::Database1::Table1=HASH(0x34a2234)'
'TestApp::Schema::Database1::Table1=HASH(0x34a7f00)'
####
[% FOREACH item IN distinct_groups %]
'[% item.group %]'
[% END %]