<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jun 10, 2009, at 1:39 PM, Stephen Clouse wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote">On Wed, Jun 10, 2009 at 12:15 PM, Jonathan Otsuka <span dir="ltr">&lt;<a href="mailto:djgoku@gmail.com">djgoku@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); margin-top: 0pt; margin-right: 0pt; margin-bottom: 0pt; margin-left: 0.8ex; padding-left: 1ex; position: static; z-index: auto; "> <div style=""><span style="font-family: Times;"><div><div>&nbsp;$c-&gt;stash-&gt;{stuff} = [</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$c-&gt;model('DB::Blah')-&gt;search(</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{},</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{ select =&gt; ['data', { count =&gt; 'data' }], group_by =&gt; ['data '] }</div> <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;)</div><div>&nbsp;&nbsp; &nbsp;];</div></div></span></div></blockquote><div><br>You want <a href="http://search.cpan.org/%7Eribasushi/DBIx-Class-0.08104/lib/DBIx/Class/ResultSet.pm#as">the "as" attribute</a> on your query:<br> </div><div><br> <span style="font-family: courier new,monospace;">$c-&gt;model('DB::Blah')-&gt;search(</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; {},</span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; { select&nbsp;&nbsp; =&gt; [ 'data', { count =&gt; 'data' } ],</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; as&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; [ 'data', 'cnt' ],</span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; group_by =&gt; [ 'data' ],</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; },</span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">);</span><br style="font-family: courier new,monospace;"><br>And then:<br><br><span style="font-family: courier new,monospace;">$rec-&gt;data;</span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">$rec-&gt;get_column('cnt');</span><br style="font-family: courier new,monospace;"><br>Note the necessity of using get_column here, since "cnt" is not an actual table column and thus won't have an auto-generated accessor method.<br> </div></div></blockquote></div><br><div>Hooray!!!&nbsp;Thank&nbsp;&nbsp;you!&nbsp;I didn't think of using an&nbsp;alias!</div><div><br></div><div>Jonathan</div></body></html>