question

overlorded avatar image
overlorded asked

Please help with query

My query looks like this

select A.player_uuid,
MAX(distinct(A.update_date) ::date)  filter (where A.payment_type in ('Deposit','DEPOSIT'))as Last_DEP_DATE,
MAX(distinct(A.update_date) ::date)  filter (where A.payment_type in ('Deposit','DEPOSIT'))-30 as Last_DEP_DATE2
from Mytable A
where A.payment_method not in ('NULL','Manual','manual')
and A.status='COMPLETED'
group by A.player_uuid

And now I need sum of deposits, from 30 days before last deposit to last deposit. in other words last active month of player (player_uuid) .

Deposit amount is stored in A.amount column

datemax
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.