I have a table as follows
+----+---------+-------------+--------+
| 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 |
+----+---------+-------------+--------+
I want to only unique ip_address SUM of amount and count duplicates as only 1.
From above table there are 4 rows from which first 2 IP addresses are same but I want to count it only one.
I am trying to SUM of amount field like this.
SELECT SUM(amount) AS total_amount FROM table
I am getting 2
as output.
But I want 1.5
as output, can you please help me regarding this issue.