Stay organized with collections
Save and categorize content based on your preferences.
Ordering results
You can specify the order of rows in your response using the ORDER BY clause,
which consists of one or more comma-separated sequences of:
FieldName ('ASC' | 'DESC')?
If you do not specify ASC or DESC after a field name, the Google Ads API will
default to ASC.
The following ORDER BY clause sorts a campaign-level report by descending
impressions and ascending campaign name:
ORDER BY metrics.impressions DESC, campaign.name ASC
Ordering is not allowed:
By attributes of non-selected resources
By non-selected metrics
By non-selected segments
For fields of the following types:
MESSAGE
Repeated fields
Attributes of repeated fields
Limiting the number of results
You can limit the total number of results returned using the LIMIT clause.
Combining this with results ordering, you can produce "top N" reports,
such as a report containing the five campaigns with the highest impressions
over the last 30 days:
SELECT
campaign.id,
campaign.name,
metrics.impressions
FROM campaign
WHERE segments.date DURING LAST_30_DAYS
ORDER BY metrics.impressions DESC
LIMIT 5
Filtering is not allowed:
On segments without selecting them, except for "core" date segment fields.
The core date segment fields are segments.date, segments.week,
segments.month, segments.quarter, and segments.year.
On fields of any message type except primitives (e.g.: Int64Value, StringValue, etc.)
On attributes of repeated fields of any message type except primitives (e.g.:
Int64Value, StringValue, etc.)
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-01-28 UTC."],[[["You can control the order of results using the `ORDER BY` clause, specifying fields and sort direction (ASC or DESC)."],["The `LIMIT` clause lets you restrict the number of returned results, enabling \"top N\" reports when combined with `ORDER BY`."],["Ordering is disallowed by attributes of non-selected resources, by non-selected metrics or segments, and for fields of type `MESSAGE`, repeated fields, or attributes of repeated fields."],["Filtering is restricted for segments without selection (excluding core date segments), fields of non-primitive message types, and attributes of repeated fields with non-primitive message types."]]],[]]