---
title: FROM and SHOW
description: >-
  Choose the tables a ShopifyQL query runs against and the metrics and
  dimensions it returns.
api_version: 2026-07
source_url:
  html: 'https://shopify.dev/docs/api/shopifyql/latest/syntax/from-and-show'
  md: 'https://shopify.dev/docs/api/shopifyql/latest/syntax/from-and-show.md'
api_name: shopifyql
---

# FROM and SHOW

Every ShopifyQL query needs [`FROM`](#from), which chooses the table or tables to query. You can use [`SHOW`](#show) to choose which metrics and dimensions to return from the table.

The table you choose in `FROM` determines the metrics and dimensions available to `SHOW`, [`WHERE`](https://shopify.dev/docs/api/shopifyql/latest/syntax/where), [`GROUP BY`](https://shopify.dev/docs/api/shopifyql/latest/syntax/group-by), [`TIMESERIES`](https://shopify.dev/docs/api/shopifyql/latest/syntax/timeseries), and other clauses. Browse the [schema reference](https://shopify.dev/docs/api/shopifyql/latest/schemas) to find each table's metrics and dimensions.

**Note:**

If a query doesn't include `SHOW`, then it must include [`VISUALIZE`](https://shopify.dev/docs/api/shopifyql/latest/syntax/visualize#visualize) to select the metric it renders.

## Syntax

```shopifyql
FROM [ORGANIZATION] table[, ...]
[SHOW metric / dimension / expression [AS alias][, ...]]
```

***

## FROM

Use `FROM` to choose the table or tables that a query runs against. A complete query includes one `FROM` clause.

A table's [schema](https://shopify.dev/docs/api/shopifyql/latest/schemas) can include dimensions from related records, so a single-table query can group and filter by those related attributes without combining tables. The selected table also determines which related records are available to [`MATCHES`](https://shopify.dev/docs/api/shopifyql/latest/syntax/where#matches) filters.

Browse the [schema reference](https://shopify.dev/docs/api/shopifyql/latest/schemas) to find each table's metrics and dimensions.

### Tables

Tables such as [`sales`](https://shopify.dev/docs/api/shopifyql/latest/schemas/sales_revenue/sales) or [`customers`](https://shopify.dev/docs/api/shopifyql/latest/schemas/customers/customers) can appear in `FROM`. Each table has a versioned schema that defines its metrics and dimensions. Select one table, or combine several in a [multi-fact query](#multi-fact-queries) when their schemas support it.

* **campaign\_​products**

  Product quantities and average order quantities for orders attributed to marketing campaigns. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/marketing/campaign_products)

* **campaign\_​sales**

  Campaign-attributed orders, sales, and average order value across first-click, last-click, last non-direct click, and linear attribution models. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/marketing/campaign_sales)

* **campaign\_​sessions**

  Campaign-attributed online store visits, including page views, cart additions, checkout progress, and conversion rates. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/marketing/campaign_sessions)

* **chargebacks**

  Payment disputes, including chargeback counts, amounts, rates, reasons, reported fraud, and [Rapid Dispute Resolution](https://help.shopify.com/en/manual/payments/chargebacks/network-dispute-resolution-programs) status. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/finance_and_payments/chargebacks)

* **collective\_​product\_​engagements**

  Engagement data for products sourced through Shopify Collective, including impressions and clicks per product per day

* **customers**

  Customer records, including first-purchase timing, new customer counts, lifetime spend, order count, average spend per order, and days since last order. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/customers/customers)

* **discounts**

  Discounted order counts and discount amounts across product, order, shipping, and app-applied discounts. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/sales_revenue/discounts)

* **fees**

  [Shopify Payments](https://help.shopify.com/en/manual/payments/shopify-payments) processing, foreign exchange, and [Managed Markets](https://help.shopify.com/en/manual/international/managed-markets) fee amounts and averages. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/finance_and_payments/fees)

* **fulfillments**

  Fulfillment speed and volume from order placement through fulfillment, shipping handoff, and delivery. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/orders/fulfillments)

* **gift\_​cards**

  Gift card issuance, sales, adjustments, disablement, and starting and ending balances over time. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/finance_and_payments/gift_cards)

* **global\_​searches**

  Global catalog search requests by product, product variant, store, and time. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/sessions_and_behavior/global_searches)

* **inventory**

  Inventory item history by stock levels, units sold, days in stock or out of stock, sell-through rate, days remaining, and inventory value over time. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/inventory/inventory)

* **inventory\_​adjustment\_​history**

  Inventory quantity changes and adjustment counts by reason, state, app, staff member, and reference document. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/inventory/inventory_adjustment_history)

* **inventory\_​by\_​location**

  Inventory stock levels, net unit changes, days in stock or out of stock, days remaining, and value by location over time. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/inventory/inventory_by_location)

* **inventory\_​shipments**

  Shipped, received, accepted, and rejected quantities by carrier, tracking, status, and origin and destination. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/inventory/inventory_shipments)

* **inventory\_​transfers**

  Inventory transfer quantities and counts by item, origin, destination, app, and staff member. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/inventory/inventory_transfers)

* **low\_​engagement\_​product\_​recommendations**

  Low-engagement product recommendations and their click-rate gap from the store's 30-day average. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/sessions_and_behavior/low_engagement_product_recommendations)

* **marketing\_​engagements**

  Engagement, spend, order, and sales metrics reported by marketing channels for marketing events. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/marketing/marketing_engagements)

* **payment\_​attempts**

  Payment attempt volume, failures, and authorization rates by payment method, amount, card details, and retry pattern. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/finance_and_payments/payment_attempts)

* **payments**

  Payment transaction amounts, refunds, gift card redemptions, payment methods, gateways, and transaction status by order and customer. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/finance_and_payments/payments)

* **payouts**

  Payout amounts from payment transactions by payout currency and date. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/finance_and_payments/payouts)

* **product\_​recommendation\_​conversions**

  Click, cart-addition, and purchase conversion metrics for online store product recommendations. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/sessions_and_behavior/product_recommendation_conversions)

* **profitability**

  Per-order profitability before returns, including revenue, cost of goods sold, shipping costs, duties, import taxes, sales taxes, and fulfillment costs. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/orders/profitability)

* **returns**

  Returned item quantities by return status, reason, refund, return app, staff member, and line item. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/sales_revenue/returns)

* **sales**

  Core sales metrics across channels, including revenue, orders, discounts, taxes, shipping, sales reversals, and customer type. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/sales_revenue/sales)

* **sales\_​taxes**

  Tax amounts applied to sales and returns by tax name, rate, location, sales channel, product, and order. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/sales_revenue/sales_taxes)

* **search\_​conversions**

  Click, cart-addition, and purchase conversion metrics for online store search sessions. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/sessions_and_behavior/search_conversions)

* **search\_​queries**

  Online store search query volume and result-click counts by query and click status. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/sessions_and_behavior/search_queries)

* **searches**

  Online store search query volume by query, intent, content type, and whether results were returned. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/sessions_and_behavior/searches)

* **sessions**

  Online store visits, page views, traffic sources, devices, visitor locations, cart additions, checkout progress, and conversion rates. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/sessions_and_behavior/sessions)

* **shipping\_​labels**

  Shipping label counts and costs by carrier, service, origin, destination, package, and order. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/orders/shipping_labels)

* **shop\_​campaign\_​insights**

  Sales, customers, ad spend, customer acquisition cost, and return on ad spend from [Shop Campaigns](https://help.shopify.com/en/manual/online-sales-channels/shop/shop-campaigns). [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/marketing/shop_campaign_insights)

* **shop\_​post\_​purchase\_​offers**

  Counts of customers who receive Shop post-purchase offers by discount code and time. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/sessions_and_behavior/shop_post_purchase_offers)

* **shop\_​product\_​impressions**

  Product impression counts in the Shop channel by product and time. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/sessions_and_behavior/shop_product_impressions)

* **shopify\_​forms**

  Views, submissions, and conversion rates for [Shopify Forms](https://help.shopify.com/en/manual/promoting-marketing/create-marketing/forms-app) by form, page type, and product. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/sessions_and_behavior/shopify_forms)

* **shopify\_​tax\_​ca\_​country**

  Taxes on Canadian sales transactions broken down by tax type (GST/HST, PST, QST, RST, VPT) and destination province, to help merchants file federal and provincial returns with the right authorities

* **shopify\_​tax\_​ca\_​transactions**

  Individual Canadian sales tax transactions, including tax type (GST/HST, PST, QST, RST, VPT), to provide detailed records for tax preparation and audit defense

* **store\_​credit\_​summaries**

  Store credit starting balance, ending balance, and net change by date and currency. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/finance_and_payments/store_credit_summaries)

* **store\_​credit\_​transactions**

  Credited, debited, and expired store credit by event, source, customer, company, order, currency, and expiration date. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/finance_and_payments/store_credit_transactions)

* **subscriptions**

  Subscription counts for active, added, and canceled subscriptions over time. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/sales_revenue/subscriptions)

* **web\_​performance**

  Online store page load, responsiveness, and visual stability metrics by page, device, browser, and storefront. [Learn more](https://shopify.dev/docs/api/shopifyql/latest/schemas/sessions_and_behavior/web_performance)

Examples

### Examples

* ####

  ##### Description

  Rank sales channels by \[\`total\_sales\`]\(/docs/api/shopifyql/latest/schemas/sales\_revenue/sales#salesmetric-propertydetail-totalsales) over the last 30 days and return \`orders\` for each channel, keeping only the top 10. This example uses \`FROM\` to draw every metric and dimension from a single table, \`sales\`.

  ##### ShopifyQL

  ```shopifyql
  FROM sales
    SHOW total_sales, orders
    GROUP BY sales_channel
    SINCE startOfDay(-30d) UNTIL today
    ORDER BY total_sales DESC
    LIMIT 10
  ```

* ####

  ##### Description

  Break down last month's \[\`total\_sales\`]\(/docs/api/shopifyql/latest/schemas/sales\_revenue/sales#salesmetric-propertydetail-totalsales) by \`product\_title\` and \`new\_or\_returning\_customer\`. This example uses \`FROM\` to group on dimensions the \`sales\` table carries from related records, so one table covers both product and customer type without a multi-fact query.

  ##### ShopifyQL

  ```shopifyql
  FROM sales
    SHOW total_sales, orders
    GROUP BY product_title, new_or_returning_customer
    DURING last_month
    ORDER BY total_sales DESC
    LIMIT 10
  ```

### Multi-fact queries

Query several tables in one request by listing them as comma-separated tables in `FROM`, such as `FROM sales, sessions`. ShopifyQL joins the tables on the dimensions they share, so a query can return metrics from each table in the same result rows. Use a multi-fact query only when the selected schemas support being combined.

Group by the dimensions that the tables share: every [`GROUP BY`](https://shopify.dev/docs/api/shopifyql/latest/syntax/group-by) field must exist with the same name in each selected schema.

Examples

### Examples

* ####

  ##### Description

  Pair daily \[\`total\_sales\`]\(/docs/api/shopifyql/latest/schemas/sales\_revenue/sales#salesmetric-propertydetail-totalsales) with \`new\_customer\_records\` over the last 30 days. This example uses a multi-fact query to read \`sales\` and \`customers\` at once, joining them on the shared \`day\` so each row pairs revenue with the customers acquired that day.

  ##### ShopifyQL

  ```shopifyql
  FROM sales, customers
    SHOW total_sales, new_customer_records
    TIMESERIES day
    SINCE -30d UNTIL today
    ORDER BY day ASC
  ```

* ####

  ##### Description

  Track daily \[\`total\_sales\`]\(/docs/api/shopifyql/latest/schemas/sales\_revenue/sales#salesmetric-propertydetail-totalsales), \`sessions\`, and \`conversion\_rate\` for last month. This example uses a multi-fact query to combine \`sales\` and \`sessions\`.

  ##### ShopifyQL

  ```shopifyql
  FROM sales, sessions
    SHOW total_sales, sessions, conversion_rate
    TIMESERIES day
    DURING last_month
    ORDER BY day ASC
  ```

### Organization queries

Use `FROM ORGANIZATION` to query a table across the stores in an organization for multi-store reporting. Filtering on `shop_id` also requires `FROM ORGANIZATION`.

**Note:**

`FROM ORGANIZATION` requires [organization analytics access](https://help.shopify.com/en/manual/your-account/users/roles/permissions/organization-permissions#analytics-overview) and a table that supports [multi-store reporting](https://help.shopify.com/en/manual/organization-settings/analytics#multi-store-reporting).

Examples

### Examples

* ####

  ##### Description

  Rank every store in an organization by last month's \[\`total\_sales\`]\(/docs/api/shopifyql/latest/schemas/sales\_revenue/sales#salesmetric-propertydetail-totalsales), grouped by \`shop\_id\`. This example uses \`FROM ORGANIZATION\` to query the \`sales\` table across all stores at once, rather than a single store.

  ##### ShopifyQL

  ```shopifyql
  FROM ORGANIZATION sales
    SHOW total_sales, shop_id
    GROUP BY shop_id
    DURING last_month
    ORDER BY total_sales DESC
  ```

* ####

  ##### Description

  Compare last month's \[\`total\_sales\`]\(/docs/api/shopifyql/latest/schemas/sales\_revenue/sales#salesmetric-propertydetail-totalsales) and \`orders\` for two named stores in an organization. This example uses \[\`WHERE\`]\(/docs/api/shopifyql/latest/syntax/where) \`shop\_id IN\` to narrow the organization-wide result to just the \`shop\_id\` values you list, instead of every store.

  ##### ShopifyQL

  ```shopifyql
  FROM ORGANIZATION sales
    SHOW total_sales, orders
    WHERE shop_id IN (123456789, 987654321)
    GROUP BY shop_id
    DURING last_month
    ORDER BY total_sales DESC
  ```

***

## SHOW

Use `SHOW` to choose which metrics, dimensions, and expressions a query returns from the table or tables chosen in `FROM`.

ShopifyQL returns result columns in the same order that you list them. When a metric, dimension, or expression uses `AS`, the returned column uses that alias in the same position.

Examples

### Examples

* ####

  ##### Description

  Chart \[\`total\_sales\`]\(/docs/api/shopifyql/latest/schemas/sales\_revenue/sales#salesmetric-propertydetail-totalsales) as a daily series for last week. This example uses \`SHOW\` to name just the one metric, letting \`TIMESERIES day\` supply the date column that turns it into a trend.

  ##### ShopifyQL

  ```shopifyql
  FROM sales
    SHOW total_sales
    TIMESERIES day
    DURING last_week
    ORDER BY day ASC
  ```

* ####

  ##### Description

  Show six \[\`sessions\`]\(/docs/api/shopifyql/latest/schemas/sessions\_and\_behavior/sessions#sessionsmetric-propertydetail-sessions) metrics for last week: overall traffic (\`sessions\`, \`conversion\_rate\`), then the funnel from \`online\_store\_visitors\` to \`sessions\_that\_completed\_checkout\`. This example uses \`SHOW\` to return columns in the order you list them, so the row reads left to right in that exact order.

  ##### ShopifyQL

  ```shopifyql
  FROM sessions
    SHOW sessions, conversion_rate, online_store_visitors,
      sessions_with_cart_additions, sessions_that_reached_checkout,
      sessions_that_completed_checkout
    TIMESERIES day
    DURING last_week
    ORDER BY day ASC
  ```

### Expressions

An expression calculates a returned value instead of returning a metric or dimension directly. Use mathematical operators to combine numeric fields or literals from the selected table or tables. Add [`AS`](#as) to give an expression a readable returned column name.

* **addition**

  **+**

  Adds two numeric values.

* **subtraction**

  **-**

  Subtracts one numeric value from another.

* **multiplication**

  **\***

  Multiplies two numeric values.

* **division**

  **/**

  Divides one numeric value by another.

Examples

### Examples

* ####

  ##### Description

  Add \[\`net\_sales\`]\(/docs/api/shopifyql/latest/schemas/sales\_revenue/sales#salesmetric-propertydetail-netsales) and \`shipping\_charges\` into a new \`net\_sales\_with\_shipping\` column for last month. This example uses a \`SHOW\` expression to compute the sum inline, keeping both inputs beside the combined total.

  ##### ShopifyQL

  ```shopifyql
  FROM sales
    SHOW net_sales, shipping_charges,
      net_sales + shipping_charges AS net_sales_with_shipping
    DURING last_month
    ORDER BY net_sales DESC
  ```

* ####

  ##### Description

  Subtract \`discounts\` from \[\`gross\_sales\`]\(/docs/api/shopifyql/latest/schemas/sales\_revenue/sales#salesmetric-propertydetail-grosssales) to report sales after discounts for last month. This example uses a \`SHOW\` expression to derive a metric the table doesn't expose directly, without leaving the query.

  ##### ShopifyQL

  ```shopifyql
  FROM sales
    SHOW gross_sales, discounts,
      gross_sales - discounts AS sales_after_discounts
    DURING last_month
    ORDER BY gross_sales DESC
  ```

### AS

Create an alias for a returned metric, dimension, or expression. Use `AS` with an unquoted identifier for simple names, or double quotes when the alias contains spaces. You can reference aliases in clauses that operate on returned values, such as [`HAVING`](https://shopify.dev/docs/api/shopifyql/latest/syntax/having) and [`ORDER BY`](https://shopify.dev/docs/api/shopifyql/latest/syntax/order-by).

Examples

### Examples

* ####

  ##### Description

  Rename \[\`total\_amount\_spent\`]\(/docs/api/shopifyql/latest/schemas/customers/customers#customersmetric-propertydetail-totalamountspent) to \`customer\_spend\` by month, year to date. This example uses \`AS\` with an unquoted alias, which works when the new name is a single identifier with no spaces.

  ##### ShopifyQL

  ```shopifyql
  FROM customers
    SHOW total_amount_spent AS customer_spend
    GROUP BY month
    SINCE startOfYear(0y) UNTIL today
    ORDER BY month ASC
  ```

* ####

  ##### Description

  Alias \[\`net\_payments\`]\(/docs/api/shopifyql/latest/schemas/finance\_and\_payments/payments#paymentsmetric-propertydetail-netpayments) to \`"Net payments"\` by payment method for last month. This example uses \`AS\` with a quoted alias so the name can contain spaces, reused with its quotes intact in \`ORDER BY "Net payments"\`.

  ##### ShopifyQL

  ```shopifyql
  FROM payments
    SHOW net_payments AS "Net payments"
    GROUP BY payment_method
    DURING last_month
    ORDER BY "Net payments" DESC
  ```

* ####

  ##### Description

  Derive \`sales\_after\_discounts\` from \[\`gross\_sales\`]\(/docs/api/shopifyql/latest/schemas/sales\_revenue/sales#salesmetric-propertydetail-grosssales) minus \`discounts\` for last month. This example uses \`AS\` to give the inline \`SHOW\` expression a readable column name that other clauses can reference in place of the calculation.

  ##### ShopifyQL

  ```shopifyql
  FROM sales
    SHOW gross_sales, discounts,
      gross_sales - discounts AS sales_after_discounts
    DURING last_month
    ORDER BY gross_sales DESC
  ```

***
