title: SUM of rows excluding duplicates in descending order
body: <p>I have a table as follows</p>
  
  <pre><code>+----+---------+-------------+--------+
  | id | user_id | ip_address  | amount |
  +----+---------+-------------+--------+
  |  1 |       2 | 192.168.1.1 | 0.5    |
  |  2 |       2 | 192.168.1.1 | 0.5    |
  |  3 |       2 | 192.168.1.2 | 0.5    |
  |  4 |       2 | 192.168.1.3 | 0.5    |
  |  5 |       5 | 192.168.5.1 | 1.5    |
  |  6 |       5 | 192.168.5.1 | 1.5    |
  |  7 |       5 | 192.168.5.3 | 0.5    |
  +----+---------+-------------+--------+
  </code></pre>
  
  <p>I want to get unique <code>ip_address</code> SUM of <code>amount</code> and count duplicates as only one.</p>
  
  <p>From above table there are 7 rows from which first 4 records are for <code>user_id</code> 2 and last 3 records for <code>user_id</code> 5.</p>
  
  <p>I am trying to SUM of amount field along with user_id in descending order and want output as follows.</p>
  
  <pre><code>user_id    total_amount
  5          2.0
  2          1.5
  </code></pre>