Home » Amazon Marketing Cloud » You are writing a query and would like to know the total impressions that have been delivered per campaign, per supply_source, and per device_type. Which of the following represents how you should write the query?

You are writing a query and would like to know the total impressions that have been delivered per campaign, per supply_source, and per device_type. Which of the following represents how you should write the query?

  • SELECT total_impressions SUM(impressions) AS device_type FROM campaign, supply_source GROUP BY 1,2,3
  • SELECT campaign, supply_source, device_type, SUM(impressions) AS impressions FROM dsp_impressions GROUP BY 1,2,3
  • SELECT campaign, supply_source, SUM(impressions) AS impressions FROM device_type GROUP BY 1,2

The correct answer is: SELECT campaign, supply_source, device_type, SUM(impressions) AS impressions FROM dsp_impressions GROUP BY 1,2,3

Explanation: To retrieve the total impressions grouped by campaign, supply_source, and device_type, you need to use the GROUP BY clause in your SQL query. The dsp_impressions table includes all granular impression records and contains the necessary fields: campaignsupply_sourcedevice_type, and impressions. The query uses SUM(impressions) to aggregate the data, and GROUP BY 1,2,3 efficiently groups the results by the first three selected columns. This syntax is directly supported in Amazon Marketing Cloud and recommended for campaign-level reporting.

Official Reference URL: https://advertising.amazon.com/API/docs/en-us/guides/amazon-marketing-cloud/datasources/dsp_impressions

N/A

Leave a Comment