in reply to Problem with table joins with Class::DBI
According to perldoc Class::DBI:
The PerlMonk tr/// Advocate
Of course, any query can be added via set_sql, including joins. So, to add a query that returns the 10 Artists with the most CDs, you could write (with MySQL):HTH.Music::Artist->set_sql(most_cds => qq{ SELECT artist.id, COUNT(cd.id) AS cds FROM artist, cd WHERE artist.id = cd.artist GROUP BY artist.id ORDER BY cds DESC LIMIT 10 }); my @artists = Music::Artist->search_most_cds();
The PerlMonk tr/// Advocate
|
---|
In Section
Seekers of Perl Wisdom