On Tue, 14 Oct 2008 08:33:13 -0700 Marc Mims <[EMAIL PROTECTED]> wrote:
> Try:
>
> my $row = $schema->resultset('Artist')->search(
> {
> },
> {
> select => [ \'1' ],
> as => [qw/one/],
> distinct => 1,
> }
> )->first;
>
> # SQL: SELECT 1 FROM artist me GROUP BY 1
> print $row->get_column('one');
> # output: 1
Thanks, I know that, but that way I cannot use the column name in an
'order_by':
$schema->resultset('Artist')->search(
{
},
{
select => [ \'1' ],
as => [qw/one/],
distinct => 1,
order_by => [ 'one' ],
}
)->first;
This throws:
DBIx::Class::ResultSet::first(): DBI Exception: DBD::Pg::st execute
failed: ERROR: column "one" does not exist at character 45 [for
Statement "SELECT 1 FROM artist me GROUP BY 1 ORDER BY one"] at test.pl
line 31
norbi
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]