[Dbix-class] SELECT from multiple tables

Byron Young Byron.Young at riverbed.com
Fri Apr 18 19:23:54 BST 2008


Emmanuel Quevillon wrote on 2008-04-18:
> Hi,
>
> I am a big fan of DBIx::Class, I think that is a great tool.
> However, I did not find an easy way to query database using
> multiple table in the FROM clause with DBIx::Class e.g:
>
> SELECT p.id, p.name, q.id, q.level FROM public p, group g
> WHERE p.id=g.id AND p.name LIKE '%class%';
>
> I know you'll answer, "Why don't you use join?". Well when I
> use join, my queries are very slow sometimes, and I realized
> that querying this way is much faster (in my case at least).
>

Hi Emmanuel,

Comma means INNER JOIN: (from http://dev.mysql.com/doc/refman/5.0/en/join.html)

'INNER JOIN and ,  (comma) are semantically equivalent in the absence of a join condition: both produce a Cartesian product between the specified tables (that is, each and every row in the first table is joined to each and every row in the second table).'

Regards,
Byron

> So I'd like to know if it is possible to create such query
> with DBIx::Class?
>
> Thanks in advance.
>
> Regards
>
> Emmanuel
> --
> -------------------------
> Emmanuel Quevillon
> Biological Software and Databases Group
> Institut Pasteur
> +33 1 44 38 95 98
> tuco at_ pasteur dot fr
> -------------------------
>
> _______________________________________________
> 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/dbix-
> class at lists.rawmode.org





More information about the DBIx-Class mailing list