Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. > with details as (
  2. select tokenize(REGEXP_EXTRACT(text, 'Statement Date: .*'))[3] as month,
  3. tokenize(REGEXP_EXTRACT(text, 'Statement Date: .*'))[5] as year,
  4. cast(tokenize(REGEXP_EXTRACT(text, 'Total Amount Due:\n.*\nAmount Enclosed'))[4] as float) as amount
  5. from "elec-bills"
  6. )
  7. select concat(month, '/', year) as billing_period, amount
  8. from details
  9. order by year asc, month;
  10.  
  11. +----------+------------------+
  12. | amount | billing_period |
  13. |----------+------------------|
  14. | 47.55 | 04/2018 |
  15. | 76.5 | 05/2018 |
  16. | 52.28 | 06/2018 |
  17. | 50.58 | 07/2018 |
  18. | 47.62 | 08/2018 |
  19. | 39.7 | 09/2018 |
  20. | <null> | 10/2018 |
  21. | 72.93 | 11/2018 |
  22. | 157.57 | 12/2018 |
  23. +----------+------------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement