generates this SQL, featuring a GROUP BY:$c->model('Database1')->resultset('Table1')->search( undef, { select => ['group'], distinct => 1, order_by => ['group'] }, )
For me, this feels strange. WrittingSELECT group FROM table1 me GROUP BY group ORDER BY group
in the query adds a GROUP BY statement. I just found the semantics of 'distinct' in the DBIx::Class::ResultSet documentation but, still, this is counter-intuitive in my opinion. So, thanks for pointing this out... ;-)distinct => 1
generates this SQL:$c->model('Database1')->resultset('Table1')->search( undef, { select => [ { distinct => 'group' }, ], as => 'group', order_by => ['group'] }, )
This second code is more like what I was looking for... Apparently the trick was to add aSELECT DISTINCT( group ) FROM table1 me ORDER BY group
clause in the query...as => '...'
In reply to Re^4: Catalyst, DBIx::Class, SELECT DISTINCT and TT
by Anonymous Monk
in thread Catalyst, DBIx::Class, SELECT DISTINCT and TT
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |