On Wed Aug 29 14:47:06 2012, Hailin Hu wrote:
you can try to define a self-reference has_one relationship on Table
2, and use the relationship in join.
you can't join tables without relationship defined.

On Wed, Aug 29, 2012 at 5:57 PM,  <t...@pasteur.fr> wrote:
Hi list,

I am not sure if such complex join has been asked on the list, but I did not
find a similar problem in the archive.
Here are my tables

Table1       Table2
fid (pk)     srcfid(pk)
name         fid(fk) <- references Table1.fid
              start
              stop

The SQL query I'd like to translate with DBIx is the following

SELECT * FROM Table1 nt1, Table2 nt2, Table 1 mt1, Table2 mt2
WHERE nt1.fid=nt2.fid AND mt1.fid=mt2.fid AND mt2.srcfid=nt2.srcfid
..... other where conditions.

So my question is, does someone would know how to translate the particular
WHERE clause (mt2.srcfid=nt2.srcfid) ?

Thanks in advance for any clue.
If this is not possible, I'll move to literal SQL using $dbh and $sth.

Regards
Emmanuel

--
-------------------------
Emmanuel Quevillon
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@lists.scsys.co.uk

Hi Hailin,

I'll try this and let the list know.
Thanks for your advice.
Emmanuel

--
-------------------------
Emmanuel Quevillon
CIB, Centre Informatique pour la Biologie
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@lists.scsys.co.uk

Reply via email to