[Dbix-class] +as not applied in +select/join/group_by

Peter Rabbitson rabbit+dbic at rabbit.us
Fri May 29 08:20:43 GMT 2009


Christian Lackas wrote:
> Hi Everbody,
> 
> I have trouble formulating this raw SQL in DBIx::Class:
> 
>     SELECT publiclinks.*, COUNT(publicdownloads.id) AS downloadcount
>     FROM publiclinks, publicdownloads 
>     WHERE publicdownloads.linkid = publiclinks.id 
>     GROUP BY publiclinks.id;
> 
> with publiclinks storing a list of resources, which can be downloaded.
> This is logged into publicdownloads and my goal is to get a joined table, which
> additionally shows me how often each resources was requested.
> 
> <snip>
> 
> Why is the '+as' not applied here? And is this the right approach?
> 

http://search.cpan.org/~ribasushi/DBIx-Class-0.08103/lib/DBIx/Class/ResultSet.pm#as

Especially pay attention to:
"It has nothing to do with the SQL code SELECT foo AS bar"



More information about the DBIx-Class mailing list