Hi Reid,

that depends on the programming language, you are using.
With Python you could do something like this, if you want to use a variable 
instead of typing the ids manually into the query:

  campaign_ids_as_string = ', '.join(str(id) for id in campaign_ids)
  query = (
    'SELECT '
    'campaign.id, '
    'campaign.name, '
    '... '
    'FROM campaign '
    f'WHERE campaign.id IN ({campaign_ids_as_string})'
    )

If you don't need that auxiliary variable "campaign_ids_as_string" anywhere 
else, you could even write 

...
    f'WHERE campaign.id IN ({', '.join(str(id) for id in campaign_ids)})'
...

Regards
Mat
reid.ho...@mediahubww.com schrieb am Dienstag, 13. Juli 2021 um 20:57:24 
UTC+2:

> Hi Pete,
>
> Thanks for the help here! I was able to successfully filter by campaign ID.
>
> How would I write this if there are multiple campaign IDs? I tried using 
> commas, ampersands, and even writing another WHERE statement. All resulted 
> in errors.
>
> Any help you could provide here would be really appreciated. 
>
> Thanks again,
> Reid
>
> On Tuesday, July 13, 2021 at 7:52:04 AM UTC-5 Pete Lavetsky (AdWords API 
> Guru) wrote:
>
>> Hey Reid,
>>
>> Use the GAQL query builder to validate your queries : 
>> https://developers.google.com/google-ads/api/fields/v8/campaign_query_builder
>>
>> SELECT campaign.id, campaign.name, 
>> campaign.vanity_pharma.vanity_pharma_text FROM campaign WHERE campaign.id 
>> = 11031113693
>>
>> Pete
>>
>> On Monday, July 12, 2021 at 3:39:22 PM UTC-4 reid.ho...@mediahubww.com 
>> wrote:
>>
>>> Hello,
>>>
>>> I'm trying to write a string query that returns a few different things-- 
>>> but I would like to filter which campaigns are returned by campaign ID. 
>>> Here's the string query I have wrote so far:
>>>
>>> String query = 
>>> "SELECT campaign.id, campaign.name, 
>>> campaign.vanity_pharma.vanity_pharma_text FROM campaign 
>>> WHERE campaign.id 11031113693 
>>> ORDER BY campaign.id";
>>>
>>> The error says:
>>>
>>> Response
>>> --------
>>> Headers: 
>>> Metadata(content-type=application/grpc,request-id=wQ_YJlu7-Ph0bn9VuLHJNg,date=Mon,
>>>  
>>> 12 Jul 2021 19:30:17 GMT,alt-svc=h3=":443"; ma=2592000,h3-29=":443"; 
>>> ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; 
>>> ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; 
>>> ma=2592000,quic=":443"; ma=2592000; v="46,43")
>>> Body: null
>>> Failure message: errors {
>>>   error_code {
>>>     query_error: UNEXPECTED_INPUT
>>>   }
>>>   message: "Error in query: unexpected input 11031113693."
>>> }
>>>
>>>
>>> It worked before I entered the "WHERE" part of the query, but now it 
>>> doesn't seem to be working. Any help you could provide on how to write this 
>>> query would be really appreciated.
>>>
>>> Thanks!
>>>
>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/ce219505-e790-44e4-9567-5f860e0286b6n%40googlegroups.com.

Reply via email to