Do you SQL? Salesforce Marketing Cloud

Alessia Mastroianni
11 min readJul 20, 2020

If you asked me “how do you find segmentation in Salesforce Marketing Cloud?” a few years ago, at the beginning of my experience with the tool, I would have rolled my eyes.
Yes, I said it, I would have rolled my eyes.

Why? Well, I am not a developer, I am not a coder and let’s say the user interface for segmentation in SFMC is quite limited compared to other technologies I have worked with in the past.
Sure, we can filter data extensions, split them, clone them and potentially use data relationship to connect multiple tables and cross filter them.
However, that day will come. The day in which none of the above will suffice and you will have to face an empty SQL activity and get the blank page syndrome.

I was lucky enough to find myself in this situation on my first assignment.
The architect I was working with was great and had a lot of knowledge, but also wanted me to fail and learn from my mistakes. He sent me to figure out how to create a segment that required to join 3 tables.
I got some directions from some of the devs in the offices, heard them talking about joins, left, right, inner, outer and I could even picture what they were referring to.
I started googling.
Brace yourself. The image I am about to share has been my guiding angel from the moment I found it and still is.

credit to herradormartinez.es

Save it now!
If you are a visual learner too, this will make the creation of segments with SQL much easier. So let’s get started.

Some technical background:

  • SQL support for the SQL Query Activity is based on MS SQL Server 2005 capabilities
  • The only supported operation is the SELECT statement. INSERT, UPDATE or DELETE are NOT allowed in the SQL statement
  • The key thing to note is that it is a set based SQL whereby the output of your select statement should produce a result set (not storing it in temporary objects)
  • The queries are case-insensitive for values and column names
  • All operations are undertaken on data stored in data extensions or system data views and results are

--

--

Alessia Mastroianni

Marketing Automation Architect working at Salesforce. 6x Salesforce certified. Salesforce #MarketingChampion 2020.