Skip to content

Instantly share code, notes, and snippets.

@achad4
Created February 5, 2023 16:51
Show Gist options
  • Save achad4/6bf4ff63707d381863b5e9b8b6da2a29 to your computer and use it in GitHub Desktop.
Save achad4/6bf4ff63707d381863b5e9b8b6da2a29 to your computer and use it in GitHub Desktop.
/*
purchase table example
transaction_date | customer_id | purchase_price | category
2022-01-01 customer_A $10 jewelry
2022-01-02 customer_A $1 t-shirts
...
2022-01-31 customer_A $5 t-shirts
*/
SELECT transaction_date, purchase_price
FROM purchase p
WHERE
customer_id = <customer_A>
AND date > CURRENT_DATE - INTERVAL '30 DAYS'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment