Where Contains Clause

24 views
Skip to first unread message

Mason Digital

unread,
Jan 10, 2020, 1:49:44 PM1/10/20
to AdWords API and Google Ads API Forum
I am trying to get only campaigns that include a keyword in their name. In this case campaign.name CONTAINS Store

query = ('SELECT campaign.id, campaign.name, segments.date, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.phone_calls FROM campaign WHERE segments.date BETWEEN \'2020-01-01\' AND \'2020-01-31\' '
             'AND campaign.name LIKE \'Store\' '
             'ORDER BY campaign.id')

This returns no results even though I have several thousand campaigns with the keyword in it. I tried various operators listed at the link before like CONTAINS ANY but they just give me attribute errors.


Any ideas what I am doing wrong/how I would achieve that.

Google Ads API Forum Advisor Prod

unread,
Jan 10, 2020, 4:51:55 PM1/10/20
to repo...@masondigital.com, adwor...@googlegroups.com

Hi Mason,

Thanks for reaching out. You will be able to retrieve the campaigns that include a keyword in their name by adding % before and after the keyword which in your case is  'AND campaign.name LIKE \'%Store%\' '. Please let me know if you have any other questions.

Thanks and regards,
Xiaoming, Google Ads API Team


 

ref:_00D1U1174p._5001USw6kW:ref

Mason Digital

unread,
Jan 10, 2020, 5:09:18 PM1/10/20
to AdWords API and Google Ads API Forum
Thank you
Reply all
Reply to author
Forward
0 new messages