[CDBI] What is the best way to search for record of table based on criteria of a field of its child table?

Kate Yoak kate at longmedia.com
Mon Jan 9 09:55:53 GMT 2006


Check out Class::DBI::Sweet.  Just scan through synopsis, and you'll see the
join and multi-step join syntax which sounds like exactly what you are
looking for.

> -----Original Message-----
> From: classdbi-bounces at lists.digitalcraftsmen.net
> [mailto:classdbi-bounces at lists.digitalcraftsmen.net]On Behalf Of Sai
> Tong
> Sent: Friday, January 06, 2006 10:11 AM
> To: classdbi at svr02.digitalcraftsmen.net
> Subject: [CDBI] What is the best way to search for record of table based
> on criteria of a field of its child table?
>
>
> Given two tables:
>
> table A --  Music::Artist
>  tha  has a one-to-many relationship with
> table B --   Music::CD  with the following setup:
>
> Music::Artist->has_many(cds => 'Music::CD');
> Music::CD->columns(All => qw/cdid artist title year reldate/);
> Music::CD->has_a(artist => 'Music::Artist');
>
> Is it possible to do the following with Class:DBI
>
> Music::Artist -> search( Music::Artist->cds->year => 1990 )
>
> ?
>
> What is the best way to search for records of table A based on criteria
> of a field of its child table like table B?
>
>
>
>
> _______________________________________________
> ClassDBI mailing list
> ClassDBI at lists.digitalcraftsmen.net
> http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
>





More information about the ClassDBI mailing list