title: Grails query rows to arrays
body: <p>I'm new to Groovy and Grails. I think this problem probably has an easy answer, I just don't know it.</p>
  
  <p>I have a database table:</p>
  
  <pre><code>id | category | caption | image | link
  </code></pre>
  
  <p>I have a query that lets me retrieve one row for each distinct item in 'category.'</p>
  
  <p>I'm trying to return a map where each row is an array named by it's category.</p>
  
  <p>e.g., If I select the rows:</p>
  
  <p><code>[{category='foo', caption='stuff', ...} {category='bar', caption='things', ...}]</code></p>
  
  <p>I want to be able to:</p>
  
  <pre><code>return [foo:foo, bar:bar]
  </code></pre>
  
  <p>where:</p>
  
  <pre><code>foo = [caption='stuff', ...]
  bar = [caption='things', ...]
  </code></pre>
  
  <p>Thanks for any help.</p>