SELECT
payment,
COUNT(*) AS order_count,
COUNT(*) / (SELECT COUNT(*) FROM analytics.prod_modeled.ORDERS WHERE (source_country = 'MEXICO' OR source_country = 'COLOMBIA') AND day_created_at BETWEEN '2023-01-01' AND '2023-12-31') * 100 AS percentage
FROM analytics.prod_modeled.ORDERS
WHERE (source_country = 'MEXICO' OR source_country = 'COLOMBIA')
AND day_created_at BETWEEN '2023-01-01' AND '2023-12-31'
GROUP BY payment
Run to view results
SELECT
payment,
COUNT(*) AS order_count,
COUNT(*) / (SELECT COUNT(*) FROM analytics.prod_modeled.ORDERS WHERE source_country = 'MEXICO' AND day_created_at BETWEEN '2023-01-01' AND '2023-12-31') * 100 AS percentage
FROM analytics.prod_modeled.ORDERS
WHERE source_country = 'MEXICO'
AND day_created_at BETWEEN '2024-02-1' AND '2024-02-28'
GROUP BY payment
Run to view results
SELECT
payment,
COUNT(*) AS order_count,
COUNT(*) / (SELECT COUNT(*) FROM analytics.prod_modeled.ORDERS WHERE source_country = 'COLOMBIA' AND day_created_at BETWEEN '2023-01-01' AND '2023-12-31') * 100 AS percentage
FROM analytics.prod_modeled.ORDERS
WHERE source_country = 'COLOMBIA'
AND day_created_at BETWEEN '2024-02-1' AND '2024-02-28'
GROUP BY payment
Run to view results