summaryrefslogtreecommitdiff
path: root/tests/examplefiles/sql+jinja/example.sql
blob: c288098d65862443a509ac7920b12d14242cb5ec (plain)
1
2
3
4
5
6
7
8
9
10
{%- set payment_methods = ["bank_transfer", "credit_card", "gift_card"] -%}

select
  order_id,
  {%- for payment_method in payment_methods %}
  sum(case when payment_method = '{{payment_method}}' then amount end) as {{payment_method}}_amount
  {%- if not loop.last %},{% endif -%}
  {% endfor %}
from {{ ref('raw_payments') }}
group by 1