Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- > with details as (
- select tokenize(REGEXP_EXTRACT(text, 'Statement Date: .*'))[3] as month,
- tokenize(REGEXP_EXTRACT(text, 'Statement Date: .*'))[5] as year,
- cast(tokenize(REGEXP_EXTRACT(text, 'Total Amount Due:\n.*\nAmount Enclosed'))[4] as float) as amount
- from "elec-bills"
- )
- select concat(month, '/', year) as billing_period, amount
- from details
- order by year asc, month;
- +----------+------------------+
- | amount | billing_period |
- |----------+------------------|
- | 47.55 | 04/2018 |
- | 76.5 | 05/2018 |
- | 52.28 | 06/2018 |
- | 50.58 | 07/2018 |
- | 47.62 | 08/2018 |
- | 39.7 | 09/2018 |
- | <null> | 10/2018 |
- | 72.93 | 11/2018 |
- | 157.57 | 12/2018 |
- +----------+------------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement