title: How to execute a complex sql statement and get the results in an array?
body: <p>I would like to execute a fairly complex SQL statement using <a href="https://github.com/stephencelis/SQLite.swift/" rel="nofollow">SQLite.swift</a> and get the result preferably in an array to use as a data source for a tableview. The statement looks like this:</p>
  
  <pre><code>SELECT defindex, AVG(price) FROM prices WHERE quality = 5 AND price_index != 0 GROUP BY defindex ORDER BY AVG(price) DESC
  </code></pre>
  
  <p>I was studying the SQLite.swift documentation to ind out how to do it properly, but I couldn't find a way. I could call prepare on the database and iterate through the Statement object, but that wouldn't be optimal performance wise.</p>
  
  <p>Any help would be appreciated.</p>