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
WHERE
orORDER BY
clause may also be required in theSELECT
clause. 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 selectingFROM ad_group
, ad group fields aren't required in theSELECT
clause, but if you want to order by the related campaign ID, you must includecampaign.id
in theSELECT
clause.The list of valid operators for
WHERE
clauses is different. The new list of supported operators is:AdWords API Google Ads API Difference CONTAINS_ALL
CONTAINS ALL
Underscore removed. CONTAINS_ANY
CONTAINS ANY
Underscore removed. CONTAINS_NONE
CONTAINS NONE
Underscore removed. DOES_NOT_CONTAIN
CONTAINS NONE
DOES_NOT_CONTAIN
requires a single value, whileCONTAINS NONE
requires a list of values. To mirrorDOES_NOT_CONTAIN
functionality, provide a single element list as the value forCONTAINS NONE
.DURING
as a separate clauseDURING
(in theWHERE
clause)DURING
is now an operator instead of a top-level clause.STARTS_WITH
LIKE
LIKE
ignores case.STARTS_WITH_IGNORE_CASE
LIKE
LIKE
ignores case.NOT_IN
NOT IN
Underscore removed. n/a BETWEEN
Only available in the Google Ads API. n/a NOT LIKE
Only available in the Google Ads API. The list of operators in AdWords API
WHERE
clauses that are not supported in the Google Ads API:CONTAINS
CONTAINS_IGNORE_CASE
DOES_NOT_CONTAIN
DOES_NOT_CONTAIN_IGNORE_CASE
You can emulate this behavior using the new
REGEXP_MATCH
operator (orNOT REGEXP_MATCH
for the negative conditions). For example, instead ofCONTAINS_IGNORE_CASE 'name'
, you could useREGEXP_MATCH '(?i).name.'
. Check out the query migration tool which can handle this conversion for you.Ordering of results is now allowed in all queries.
Limiting the number of results is now allowed in all queries. Previously, there was a
LIMIT
clause 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.SearchStream
is recommended in most cases. You can still page by using theGoogleAdsService.Search
method which uses a page token so you can pick up directly where you left off, rather than theLIMIT
clause that was present in AWQL. You can specify a page size as part of the request to theGoogleAdsService
.Date filtering is different. There is no longer a
DURING
clause; instead,DURING
is an operator that can be used inWHERE
clauses. Filter the fielddate
using theDURING
clause for the same functionality as theDURING
clause 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 groupStatus
values as:ad_group.status IN (ENABLED, PAUSED)