On Mon, May 07, 2007 at 02:44:01PM +0200, Dmitri Pissarenko wrote: > Hello! > > I have a table with "activities" and each of them has a certain > duration. Each activitiy is assigned to one category. > > I want to create a table, in which > > a) each category is shown and > b) for each category the sum of durations of its activities is shown. > > In other words, I want to display the results of this query: > > select SUM(duration), categories.name > FROM activities, categories > WHERE activities.categoryId = categories.id > GROUP BY activities.categoryId > ORDER BY categories.name > > How can I execute this query in Catalyst and fetch the results?
http://search.cpan.org/~blblack/DBIx-Class-0.07006/lib/DBIx/Class/Manual/Cookbook.pod#Grouping_results Assuming you'r using DBIx::Class. Note that questions like this should be asked on the dbix-class list, not the Catalyst list - Catalyst supports the use of a number of database libraries and indeed applications that don't use a database at all, so while a lot of people -are- using DBIC it's still a bit off-topic :) -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Director Want a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://www.shadowcatsystems.co.uk/ _______________________________________________ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/