Skip to content

Commit

Permalink
mess up column orders
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenwindflower committed Jun 28, 2024
1 parent 10846ee commit 4ab7588
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions models/marts/customers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ customer_orders_summary as (
select
orders.customer_id,

count(distinct orders.order_id) as count_lifetime_orders,
count(distinct orders.order_id) > 1 as is_repeat_buyer,
min(orders.ordered_at) as first_ordered_at,
max(orders.ordered_at) as last_ordered_at,
count(distinct orders.order_id) as count_lifetime_orders,
sum(orders.order_total) as lifetime_spend
sum(orders.subtotal) as lifetime_spend_pretax,
min(orders.ordered_at) as first_ordered_at,
sum(orders.tax_paid) as lifetime_tax_paid,
sum(orders.order_total) as lifetime_spend
max(orders.ordered_at) as last_ordered_at,

from orders

Expand All @@ -36,12 +36,12 @@ joined as (
select
customers.*,

customer_orders_summary.count_lifetime_orders,
customer_orders_summary.first_ordered_at,
customer_orders_summary.last_ordered_at,
customer_orders_summary.lifetime_spend_pretax,
customer_orders_summary.count_lifetime_orders,
customer_orders_summary.lifetime_tax_paid,
customer_orders_summary.lifetime_spend,
customer_orders_summary.first_ordered_at,
customer_orders_summary.last_ordered_at,

case
when customer_orders_summary.is_repeat_buyer then 'returning'
Expand Down

0 comments on commit 4ab7588

Please sign in to comment.