The syntax for Google Ads Query Language is similar to AWQL from the AdWords API, with some minor changes.
Fields you want to use in a
ORDER BYclause may also be required in the
SELECTclause. Fields directly on the resource you are selecting are not required, but if you want to filter or sort by a field on another related resource, you must select that field explicitly. For example, if you are selecting
FROM ad_group, ad group fields aren't required in the
SELECTclause, but if you want to order by the related campaign ID, you must include
The list of valid operators for
WHEREclauses is different. The new list of supported operators is:
AdWords API Google Ads API Difference
DOES_NOT_CONTAINrequires a single value, while
CONTAINS NONErequires a list of values. To mirror
DOES_NOT_CONTAINfunctionality, provide a single element list as the value for
DURINGas a separate clause
DURINGis now an operator instead of a top-level clause.
Underscore removed. n/a
Only available in the Google Ads API. n/a
Only available in the Google Ads API.
The list of operators in AdWords API
WHEREclauses that are not supported in the Google Ads API:
Ordering of results is now allowed in all queries.
Limiting the number of results is now allowed in all queries. Previously, there was a
LIMITclause that was used with the query method of the AdWords API services to define the page size and start index. The idea of using a limit with a page size and start index no longer is used in the Google Ads API.
GoogleAdsService.SearchStreamis recommended in most cases. You can still page by using the
GoogleAdsService.Searchmethod which uses a page token so you can pick up directly where you left off, rather than the
LIMITclause that was present in AWQL. You can specify a page size as part of the request to the
Date filtering is different. There is no longer a
DURINGis an operator that can be used in
WHEREclauses. Filter the field
DURINGclause for the same functionality as the
DURINGclause in AWQL. For example:
... WHERE segments.date DURING LAST_30_DAYS ... WHERE segments.date >= '2020-01-01' AND segments.date <= '2020-01-31' ... WHERE segments.date >= '2020-01-01'
The syntax for lists has changed. In the AdWords API, you used
brackets. In the Google Ads API, use
()parentheses instead. For example, you would specify a predicate for a list of ad group
ad_group.status IN (ENABLED, PAUSED)