[Dbix-class] Query translation
fREW Schmidt
frioux at gmail.com
Thu May 10 17:03:01 GMT 2012
> 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 =3D sb.server_id
>> and ss.server_id =3D s.server_id) as num_subsystems
>> FROM
>> account a,
>> server s
>> WHERE a.account_id =3D 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/Hel=
per/ResultSet/CorrelateRelationship.pm
-- =
fREW Schmidt
http://blog.afoolishmanifesto.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20120510/916=
49e35/attachment.htm
More information about the DBIx-Class
mailing list