Hello!

I have a simple tree-like structure of galleries, albums and photos; to count photos in all albums, I've tried to

sub count_photos {
   my $self = shift;
   return $self->photos->search->count;
}

in Album class.

However, this yields

SELECT COUNT( * ) FROM album me LEFT JOIN photo photos ON ( photos.aid = me.aid ) WHERE ( me.gid = ? ): '1'

which apparently returns wrong result. Can I somehow

select count(*) from photo photos LEFT JOIN album me ON ( photos.aid = me.aid ) WHERE ( me.gid = ? ) ?

Or am I missing something quite SQL-trivial?

Alex.


_______________________________________________
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]

Reply via email to