payments |
---|
customer_id |
payment_id |
payment_amount |
payment_date |
If you want to count the number of days between each payment and today then you can use extract
function with days
as a parameter:
select payment_id,
payment_date,
extract(days from now() - payment_date) as days_since_payment
from payments