If you sell the same products on both channels, you need to know which channel is more profitable for each SKU. This query finds overlapping SKUs and compares revenue, units, and margins side by side.
This is part of the Taptic Data eCommerce query library. Explore related queries: SQL query for Amazon revenue by month, SQL query for Shopify revenue by month, and more.
The question
The SQL Taptic generates
WITH amazon_skus AS ( SELECT i.sku, SUM(i.item_price * i.quantity) AS amazon_revenue, SUM(i.quantity) AS amazon_units, COUNT(DISTINCT o.amazon_order_id) AS amazon_orders FROM amazon_order_items i JOIN amazon_orders o ON o.amazon_order_id = i.amazon_order_id WHERE o.order_status NOT IN ('Canceled', 'Cancelled') AND i.item_price IS NOT NULL AND o.purchase_date::date >= CURRENT_DATE - INTERVAL '90 days' GROUP BY i.sku ), shopify_skus AS ( SELECT li.sku, SUM(li.price * li.quantity) AS shopify_revenue, SUM(li.quantity) AS shopify_units, COUNT(DISTINCT li.order_id) AS shopify_orders FROM shopify_order_line_items li JOIN shopify_orders o ON o.id = li.order_id WHERE o.financial_status IN ('paid', 'partially_refunded') AND o.cancelled_at IS NULL AND o.created_at >= NOW() - INTERVAL '90 days' GROUP BY li.sku ) SELECT COALESCE(a.sku, s.sku) AS sku, ROUND(COALESCE(a.amazon_revenue, 0)::numeric, 2) AS amazon_revenue, COALESCE(a.amazon_units, 0) AS amazon_units, ROUND(COALESCE(s.shopify_revenue, 0)::numeric, 2) AS shopify_revenue, COALESCE(s.shopify_units, 0) AS shopify_units, ROUND((COALESCE(a.amazon_revenue, 0) + COALESCE(s.shopify_revenue, 0))::numeric, 2) AS combined_revenue, CASE WHEN a.sku IS NOT NULL AND s.sku IS NOT NULL THEN 'Both' WHEN a.sku IS NOT NULL THEN 'Amazon only' ELSE 'Shopify only' END AS channel_status FROM amazon_skus a FULL OUTER JOIN shopify_skus s ON s.sku = a.sku ORDER BY combined_revenue DESC LIMIT 50
This query was generated by Taptic Data from plain English against a real Amazon Seller Central + Shopify schema. In Taptic, you type the question โ the AI writes the SQL, runs it, and returns the result. You can edit the SQL, ask for explanations, and save it as a refreshable report.
How this query works
What it returns
SKU-level revenue and unit comparison across Amazon and Shopify, with channel overlap status and combined revenue.
Why it matters
FAQ
Generate this automatically
In Taptic Data, you type "Show me SKUs that sell on both Amazon and Shopify with reven..." and this SQL runs automatically against your real Amazon Seller Central + Shopify data.
Try Taptic Free โ $29.99/moNo credit card required. Connect your data source in under 5 minutes.
Compare tools