Forum Discussion

alpb's avatar
alpb
Frequent Visitor
5 years ago
Solved

Group by date into month

From table A

date       organization_id merchant_id price number_of_bookings

01/01/18          A                   1001       50                   3

02/01/18          A                   1001       30                   2

01/01/18          B                   1031       50                   3

02/01/18          B                   1041       30                   2

 

I would like to aggregate the date into month, so that table A becomes:

date       organization_id merchant_id price number_of_bookings

01/18          A                   1001       80                   5

01/18          B                   1031       50                   3

01/18          B                   1041       30                   2

 

The aggregation I'd like is group by organization_id, by merchant_id, sum price, sum number_of_bookings.

How can I achieve this?

 

*Please note that I try to aggregate date into month to trim the file size, not just for visualization purposes.

5 Replies