Category: Other functions

NAMED_ROW

NAMED_ROW groups several columns under one name, each with its own label, in a single result column.

Syntax

NAMED_ROW('label1', column1, 'label2', column2)

AMC specifics

  • The labels serve as identifiers for the bundled columns. This helps when a query should output several related values together.
  • Give the result a column name with AS.

Example

Impressions and clicks per campaign in one bundled column.

WITH totals AS (
  SELECT
    campaign,
    SUM(impressions) AS impressions,
    SUM(clicks) AS clicks
  FROM
    sponsored_ads_traffic
  GROUP BY
    1
)
SELECT
  campaign,
  NAMED_ROW('impressions', impressions, 'clicks', clicks) AS performance
FROM
  totals

Checked against the AMC schema, not executed on an AMC instance.

Related functions: COLLECT

Source: advertising.amazon.com (retrieved 2026-10-09)