[Dbix-class] Multi table join
Jon Molin
jon.molin at gmail.com
Sat Dec 31 12:01:39 CET 2005
In the DBIx::Class::Manual::Cookbook there's an example with an author/book
seems like the database is somewhat like this:
author
authID int
first_name varchar
last_name varchar
book2author
authID int
bookID int
book
bookID int
title varchar
...
Now, if I know the title starts with foo% but want to limit my result to
authors bar% I'd go like this in sql:
SELECT a.*, b.* FROM book b, author a, book2author a2b
WHERE (b.title LIKE 'foo%' AND a.first_name LIKE 'bar%') AND
(b.bookID = a2b.bookID AND a.authID = a2b.authID
I've two questions regarding this. First, how to do it? I can't find much
documentation and in the doc I've found haven't I found a way to do a multi
table join. Secondly where would be a sane place to put a function like
this? Would Book2Author.pm be the correct place since it's the table
connecting them?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/dbix-class/attachments/20051231/fb96c14a/attachment.htm
More information about the Dbix-class
mailing list