title: SELECT MAX from one column with SUM and GROUP BY for another, without subqueries
body: <p>Consider the following table.</p>
  
  <pre><code>+----+------+--------+-------------+---------------------+
  | id | user | amount | description |       paid_on       |
  +----+------+--------+-------------+---------------------+
  |  1 |    1 |    200 | wire        | 2017-09-01 15:45:52 |
  |  2 |    2 |    200 | paypal      | 2017-09-09 05:05:05 |
  |  3 |    3 |    150 | cash        | 2017-09-02 12:34:56 |
  |  4 |    1 |     20 | wire        | 2017-01-09 01:23:45 |
  +----+------+--------+-------------+---------------------+
  </code></pre>
  
  <p>I'm trying to get the total payments for each user, and the last payment date for that same user. For this, I'm using</p>
  
  <pre><code>    SELECT
          user,
          ROUND(SUM(amount),2) AS amount,
          date_format(paid_on, '%d.%m.%Y.') AS paid_on
      FROM
          (
              SELECT
                  user,
                  amount,
                  paid_on
              FROM payments
              WHERE paid_on BETWEEN '2017-09-01 00:00:00' AND '2017-09-30 23:59:59'
              ORDER BY paid_on DESC
           ) tmppayments
      GROUP BY user
  </code></pre>
  
  <p>It works as I expect it to, as it returns what I had in mind. However, using a subquery seems like an overkill. Is it possible to do this with a simple(r) query, without resorting to any subqueries?</p>