title: mysql avg on conditional
body: <p>is it possible to get the average value for a column, as well as the average value for the same column with a conditional? or simply to combine these two queries into one.</p>
  
  <pre><code>SELECT AVG( field ) from table
  
  SELECT AVG ( field ) from table where col = some_val
  </code></pre>
  
  <p>If there isn't a simple way to combine them using native mysql functions, would a stored function be able to handle it, or a user defined function?</p>