>  SELECT
>>             s.server_id,
>>             a.account_code,
>>             s.server_name,
>>             s.server_type,
>>             s.os_name,
>>             (select count(*) from server ss, subsystem sb
>>                    where ss.server_id = sb.server_id
>>                    and ss.server_id = s.server_id) as num_subsystems
>>            FROM
>>             account a,
>>             server s
>>            WHERE a.account_id = s.account_id
>>            order by a.account_code, s.server_name
>>
>
Actually, I *just* released a helper that will do the correlated subquery
for you.  Check it out here:
http://search.cpan.org/~frew/DBIx-Class-Helpers-2.008000/lib/DBIx/Class/Helper/ResultSet/CorrelateRelationship.pm
-- 
fREW Schmidt
http://blog.afoolishmanifesto.com
_______________________________________________
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