You can create a view for this query. e.g.<br>CREATE VIEW stats AS SELECT MIN(a), MAX(a), AVG(a) FROM table1;<br><br><div class="gmail_quote">On Mon, Sep 21, 2009 at 10:42 AM, Trevor Phillips <span dir="ltr">&lt;<a href="mailto:trevor.phillips@gmail.com">trevor.phillips@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I have a table of logged data, which is too granular to browse row by<br>
row. What I want to do is display a row per hour of data, and include<br>
average/min/max for each field.<br>
<br>
I can do this in SQL, using group by with a formatted timestamp field<br>
to group per hour, along with AVG(), MIN(), MAX() on each field to get<br>
the values I&#39;m after. I can replicate the query in DBIx by defining<br>
&#39;select&#39; and &#39;as&#39;. However, I can&#39;t access these, I&#39;m assuming because<br>
I&#39;ve given them names which don&#39;t match my DBIx::Class&#39; defined column<br>
names. A dump of the DBIx::Class shows the values in there as part of<br>
_column_data.<br>
<br>
So, for example, if my class has a column &quot;foo&quot;, as does my DB table,<br>
then what I want to access is foo_avg, foo_min and foo_max.<br>
<br>
Is there an easy way to get a search resultset to auto-create the new columns?<br>
Is there a better way to accomplish what I&#39;m after?<br>
<br>
I&#39;m using DBIx::Class within Catalyst, with a MySQL DB, and Template<br>
Toolkit for presentation.<br>
<br>
Thanks.<br>
<br>
--<br>
Trevor Phillips  - <a href="http://dortamur.livejournal.com/" target="_blank">http://dortamur.livejournal.com/</a><br>
&quot;On nights such as this, evil deeds are done. And good deeds, of<br>
course. But mostly evil, on the whole.&quot;<br>
      -- (Terry Pratchett, Wyrd Sisters)<br>
<br>
_______________________________________________<br>
List: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class</a><br>
IRC: <a href="http://irc.perl.org#dbix-class" target="_blank">irc.perl.org#dbix-class</a><br>
SVN: <a href="http://dev.catalyst.perl.org/repos/bast/DBIx-Class/" target="_blank">http://dev.catalyst.perl.org/repos/bast/DBIx-Class/</a><br>
Searchable Archive: <a href="http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk" target="_blank">http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk</a><br>
</blockquote></div><br>