I have a transaction table which contains net_amount
field and last_updated_time
field, where last_updated_time
is stored as milliseconds. I need to get total amount group by using month, year or date. How can I do this in PostgreSQL?
My table looks like as below:
+------------+-------------------+
| net_amount | last_updated_time |
+------------+-------------------+
| 100 | 1470286872831 |
+------------+-------------------+
| 200 | 1471594713801 |
+------------+-------------------+
| 300 | 1471594651335 |
+------------+-------------------+
and expecting result as:
+----------+---------------+
| month | sum_of_amount |
+----------+---------------+
| january | 1000 |
+----------+---------------+
| february | 2000 |
+----------+---------------+
| --- | ---- |
+----------+---------------+