I've recently tried to create a query activity.

Our Marketing Cloud is connected to our Salesforce via Marketing Cloud Connector, and we are syncing contact data.

I'm trying to flag our contacts who ever hard bounced.

So I assembled the following sql:

      Id as SubscriberKey, 
      channel__c as Channel, 
         (SELECT count(*) FROM _Bounce b 
          WHERE b.SubscriberKey = csf.Id AND b.BounceCategory = 'Hard bounce') > 0
      ) as HasHardBounced
FROM Contact_Salesforce csf

My experience with SQL tells me this is valid, and sure enough I tried this with SQL developer, and it worked. But in Marketing Cloud it gives me an error:

"An error occurred while checking the query syntax. Errors: Incorrect syntax near '>'."

Any ide why it not letting me use an operator there? Also any other way to achieve what I was trying?

Thanks for your help!

1 Answer 1


There's no aggregation/grouping going on in your query there to do the "> 0" evaluation.

Try this:

      csf.Id as SubscriberKey, 
      csf.channel__c as Channel, 
      COUNT(1) as HasHardBounced
    Contact_Salesforce csf INNER JOIN
    _Bounce b WITH (NOLOCK)
        ON  b.SubscriberKey = csf.Id
    b.BounceCategory = 'Hard bounce'
    COUNT(1) > 0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.