under Postgres 9.3 I am trying to run a query to summarize some data from table a:
| Entry date-Date | Customer ID-charvar | received-Boolean | Processed-Boolean | finalized-Boolean | billed-Date |
I would like use
count(case when) to count all the records by the current week, month, then all of time into table b:
|report date | Total Received Weekly | Received Monthly | Received all of time | so on...
I am having a difficult time wrapping my head around how to write that query. I have thought about extracting the week day and month number to determine my records to sum for each length of time but then how would I make it repeatable without having to change the dates so I could automate it to run weekly through either PgAgent or CRON?