title: How to make aggregations with slick
body: <p>I want to force slick to create queries like </p>
  
  <pre><code>select max(price) from coffees where ... 
  </code></pre>
  
  <p>But <a href="http://slick.typesafe.com/doc/1.0.0-RC1/lifted-embedding.html#aggregation" rel="noreferrer">slick's documentation</a> doesn't help</p>
  
  <pre><code>val q = Coffees.map(_.price) //this is query Query[Coffees.type, ...]
  val q1 = q.min // this is Column[Option[Double]]
  val q2 = q.max
  val q3 = q.sum
  val q4 = q.avg 
  </code></pre>
  
  <p>Because those q1-q4 aren't queries, I can't get the results but can use them inside other queries.</p>
  
  <p>This statement</p>
  
  <pre><code>for {
    coffee &lt;- Coffees
  } yield coffee.price.max
  </code></pre>
  
  <p>generates right query but is deprecated (generates warning: " method max in class ColumnExtensionMethods is deprecated: Use Query.max instead").
  <strong>How to generate such query without warnings?</strong></p>
  
  <p>Another issue is to aggregate with group by:</p>
  
  <pre><code>"select name, max(price) from coffees group by name"
  </code></pre>
  
  <p>Tried to solve it with</p>
  
  <pre><code>for {
    coffee &lt;- Coffees
  } yield (coffee.name, coffee.price.max)).groupBy(x =&gt; x._1)
  </code></pre>
  
  <p>which generates </p>
  
  <pre><code>select x2.x3, x2.x3, x2.x4 from (select x5."COF_NAME" as x3, max(x5."PRICE") as x4 from "coffees" x5) x2 group by x2.x3
  </code></pre>
  
  <p>which causes obvious db error</p>
  
  <pre><code>column "x5.COF_NAME" must appear in the GROUP BY clause or be used in an aggregate function
  </code></pre>
  
  <p><strong>How to generate such query?</strong></p>