[Dbix-class] join and where

Patrik Wallstrom pawal at blipp.com
Thu Jan 4 21:04:11 GMT 2007


I am still trying to wrap my head around DBIx::Class, and I am trying
to create a little app with it. Currently I have four tables, "feed",
"item", "user" and "subscription". The "subscription" table contains
a primary key consisting of user_id and feed_id.

From that I woule like to retrieve the items in pubdate order, like
this in SQL:

select
    i.item_id,i.enclosure
from
    item i
inner join
    subscription s on i.feed_id=s.feed_id
where
    s.user_id = 1
order by i.pubdate
desc limit 30;

I really can't figure out how to do it from the artist/cd examples in
cookbok. Subscription has not a direct relation with item. The
subscription class is properly setup as a has_many with belongs_to.

-- 
patrik_wallstrom->foodfight->pawal at blipp.com->+46-733173956



More information about the Dbix-class mailing list