[Dbix-class] Select from subselect

Allan Cochrane allan.cochrane at gmail.com
Thu Dec 15 19:10:08 GMT 2011


Hi,

have trawled through the docs and Googled but still cannot fathom how to do
this in DBIc::Class

SELECT test_result_idFROM   (SELECT MAX(created_at) AS latest,
               pdt_revision_fk,
               test_revision_fk
        FROM   test_wide_fact
        WHERE  (( test_wide_fact.ignore_result =3D false
                  AND test_wide_fact.pdt_revision_fk IN (
1729554724791742389 ) ))
        GROUP  BY pdt_revision_fk,
                  test_revision_fk) ltst
       JOIN test_wide_fact
         ON ltst.latest =3D test_wide_fact.created_at
            AND ltst.pdt_revision_fk =3D test_wide_fact.pdt_revision_fk
            AND ltst.test_revision_fk =3D test_wide_fact.test_revision_fk;



I cannot see how to select from a select and then do a join, if anyone could
point me to some examples then I'd be grateful!

Allan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20111215/e6d=
669d3/attachment.htm


More information about the DBIx-Class mailing list