Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [sql]

Structured Query Language (SQL) is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS)

0
votes
1answer
23 views

SQL Query on _Sent Data View for Suppression List (5 sends in 7 days)

I'm working in a new org where we don't have any send data. I need to set up a suppression list for any subscriber that received 5 emails in the last 7 days. I am not 100% sure if my code below will ...
1
vote
1answer
42 views

SQL Query Activity Data Extension Values are Case Sensitive

Are Data Extension values case sensitive when querying with SQL query activity? I found this to be the case when querying WHERE Status = 'Active' that it ignored records with a status value of "...
1
vote
1answer
33 views

How to update a field in a DE using sql?

I have a DE where i have 3 fields(cost price , selling price and on sale).If the selling price>cost price...then on sale field should be updated as "True"(on sale is boolean field.).What is the query ...
1
vote
1answer
19 views

Geolocation Query [closed]

I have two lists within SFMC that both have latitude and longitude values. I need to be able to compare them and find the distance between them in miles, then include or exclude records based on the ...
1
vote
1answer
45 views

SQL code unknown

I found a piece of code in our cloud that was written by someone in the past, and I don't know what it does (I have no developer experience). %%[ if Not Empty(@zip) Set @rows = LookupRows(...
1
vote
1answer
40 views

Using SQL to compare and update data extension

I need to use SQL in an automation to compare the data from the "TemporaryDE" with the Data from the "CompareDe". If the CompanyName value from the "TemporaryDE" is not present in the "CompareDe" - to ...
1
vote
1answer
34 views

Marketing cloud sql query execution error - Violation of PRIMARY KEY constraint

I'm getting following error during update activity. Query failed during execution. Error: Violation of PRIMARY KEY constraint. Cannot insert duplicate key in object 'Enq_opp_Parallel_ContactView'. The ...
1
vote
1answer
29 views

Marketing Data Extension `Last Click Date` from data views

I have a query that's intended to update a field named Last_Click_Date based on the most recent EventDate from the _Click data view. It doesn't appear to be grabbing the most recent date param and ...
3
votes
1answer
37 views

Query association to automation viewable?

Is it possible to see which automation a query activity is part of?
1
vote
1answer
41 views

Marketing Cloud SQL Query 1 to many only get result if only 1 record is present in that Data Extension

I know a thing or two about SQL Queries, but in this case i can't figure out what to do. So in this case we have a Contact_Salesforce DE where all contacts are in. We have another DE named ...
3
votes
2answers
52 views

Remove characters after @ in email address and replace with new domain

I have four brands that all use different email domains however our SF only has one email allocated per user with a random branded domain. eg usera@brand-a.com also uses @brand-b.com, @brand-c.com and ...
0
votes
1answer
23 views

Merging Content from the same field across multiple records through SQL in Salesforce Marketing Cloud

I have a DE that collects information about past reservations for travel. One of the fields is named FareDiscountCode. I currently have in place a query from that table that combines all of the ...
0
votes
1answer
28 views

Filter in a 1:many relationship for one value only

we have two Data Extensions - DE1 one storing client's data and another one, DE2, storing information on with a 1: many relationship. We now need to filter on exactly one of the values DE2 Data. ...
0
votes
2answers
62 views

SQL How to create a separate record for comma delimited values in within a field

I have a table which have two fields ID and Source. Source col. have multiple emails with comma separated. I want to create a separate record for each email with same ID. So data looks like this ID ...
1
vote
0answers
62 views

SFMC: SQL Query on Dataview objects to calculate Journey's sends, opens, and clicks

I want to calculate the sends, opens, and clicks of all journeys. Expecting the records in Date Extension consists of records in the following sequence: JourneyActivityObjectID VersionID ActivityName ...
0
votes
0answers
31 views

Retrieve last order with SQL

Good time of the day! Could somebody help - I am trying to retrieve the latest orderers based on the OrderDate, but in the end I still receive the DE with records with random date. My query is the ...
1
vote
1answer
40 views

Marketing Cloud SQL ORDER BY not working

I am at the Parent Enterprise Level and trying to sort the SubscriberKey column from the All Subscribers List into a Target Data Extension: All_Subscribers_DE. The columns are populated but the ORDER ...
0
votes
1answer
71 views

SystemDateToLocalDate inside SQL Automation

I know the function SystemDateToLocalDate is not available inside SQL but i would like exactly that feature inside an SQL query to convert the Date records of data_views (which are CST Central ...
0
votes
1answer
67 views

How to send an email, three days before birthday using SQL query in salesforce marketing cloud?

I am new to salesforce marketing cloud. How to send an email, three days before birthday date using SQL query or using data filter Automation studio. Could anybody please help me.
0
votes
1answer
22 views

Write to LIST from a DATA EXTENSION

I am trying to pull subscriber information from a Data Extension, and then add it into a custom list. I understand that the ideal process is to create a data extract, then import the CSV into the ...
0
votes
0answers
24 views

How to get my all records with null records using SQL query in salesforce marketing cloud

I have created one 'TEST' Data extension using Email and FirstName fields which are not primary fields. In this data extension have three records one is null record. Now my requirement is how to get ...
1
vote
3answers
76 views

SQL multiple WHERE clause problem

I have a SQL query that puts records from one DE to another DE if that record does not exists in the second DE. The base works fine for me and i have the following query: select t.Emailaddress from [...
0
votes
1answer
54 views

Is it possible to write a SQL Query to extract send data that includes Tags and/or Campaign names

We are trying to do some reporting based on emails with specific tags or associated to specific campaigns over the past 12 months. I have tired to use the Analytics builder > Reports to get the data ...
2
votes
3answers
47 views

Optimize a query that is timing out

I have two data extensions that I need to join and filter. One stores member data for a product, the other stores opt-in status for all products. The DE with opt-in status can have multiple instances ...
0
votes
1answer
27 views

Marketing Cloud - Does table exist

I'm looking for a way, using SQL, to see if a table exists for any random given name I've tried creating a simple "Select * from MyRandomTableName" but this doesn't work in Marketing Cloud as i need ...
0
votes
1answer
31 views

Remove Special Characters SQL

I am currently trying to run an SQL qeuery that strips out special characters and then adds a '1' in front to have all numbers correctly formatted. For what ever reason my REPLACE doesn't seem to work ...
0
votes
0answers
12 views

Trying to query the _open and click tables to fill a new table with the email of the users who have opened or clicked a link in an email

I'd like a query to pull from a specific email which is in content builder. What would my query look like? Also what columns are needed for the target Data Extension?
1
vote
1answer
20 views

Pulling every email job an email address has ever received

I am looking to pull all the email jobs that a particular email address has received. The issue is our transactional unit uses email as a the subscriber key and our promotional unit uses unique ...
1
vote
1answer
35 views

SQL Won't Populate Salesforce Data Extension

I am trying to dump data from a Salesforce object into a Salesforce Data Extension. I am not getting an errors but the data refuses to populate. I can't figure out what I am doing wrong! I have tried ...
0
votes
1answer
34 views

Anonymous Execution: System.LimitException: Too Many DML Statements: 151

I am trying to run the following piece of code to update all Accounts without a primary contact. This method will look through all contacts of an account and assign the first contact it reads to be ...
0
votes
1answer
40 views

How to display Month in TEXT format using SQL query in marketing cloud?

I create one Data Extension name is 'TEST' using Day, Month and Year fields. I have done this scenario in number format. But I need to Display Month in Text format. How is it possible? please anybody ...
0
votes
1answer
46 views

How to separate The Day, Month and Year attributes using SQL _Open query in salesforce marketing cloud?

I have creating TestDE Data extension using these attributes like SubscriberKey, AccountID, EventDate, Date, Month, Year attributes. And Created with same attributes using Target Data extension. Now ...
1
vote
1answer
38 views

Generic System Error when I use a Left Join

I'm creating an automation that uses a series of SQL queries to identify people who were potentially targeted for a dynamic content block in an email, determine if they were included in a job that ...
2
votes
0answers
36 views

Left Join query

I'm trying to left join a table in Marketing Cloud Automation Studio Query. I don't receive any errors but the expected data is not pulling into the data extension. The bolded statements are what are ...
2
votes
1answer
34 views

Find a count of clicks per subscriber and LinkName

I'm in the process of building a query that will give me a count of all links a subscriber has clicked on with one of three aliases. The possible alias's are "watch", "win", and "play". I've written ...
0
votes
1answer
44 views

Simple query troubleshooting

I have a simple query that is erring out. I cannot figure out why, as it is so simple. The target data extension has a primary key on contact_key. Both fields (unsubscribe & newsletter) from ...
0
votes
1answer
34 views

Query Activity for suscribers that opened campaigns

We want to get a Data Extension with only de emails of subscribers that opened certain JobIDs. I ran this SQL Activity but the targeted Data Extension shows 0 records after it finished running. What ...
0
votes
1answer
36 views

SFMC SQL query to update related records

Scenario: I need to update all children from a family based on the values populated from a single child. So if Child A has a city of 'London' for example, I would want Child B and C to have 'London' ...
0
votes
0answers
14 views

How to measure responses to a content block used in multiple sends

I have a saved piece of content that I have used in dynamic content blocks in multiple emails. I want to measure the opens and clicks that the content received to see how effective it was. What's the ...
0
votes
1answer
32 views

Extracting Open counts from Data Views and match against Salesforce Account ID's

I would like to extract my Opens into a statistics table that contains columns like Last Opened 7 Days. To achieve this I am using the Data Views to query out the _opens table. The target Data ...
0
votes
2answers
82 views

Does IsUnique in the _Click data view dedupe subscribers over multiple jobs?

I want to write a SQL query that will find the total clicks and unique clicks for 1 URL across multiple email sends. Total clicks is easy, but I'm not sure about the unique clicks. I want to basically ...
0
votes
1answer
46 views

Last updated date on custom data extension created in salesforce marketing cloud

I've created a data extension in marketing cloud based on sql query. I update this data extension manually on need basis (usually one or two times in a month). Logic for data extension - 1. Data ...
1
vote
1answer
552 views

SAQL vs SOQL vs SOSL vs SQL? [closed]

I have recently come across SAQL and I'd like to understand the differences between all the different ways to query against Salesforce APIs. The new einstein branding is too complex to get my head ...
0
votes
1answer
77 views

How to write a simple SQL query to identify records who have been sent an email

I'm a Marketing Cloud SQL beginner and I've been struggling to find a simple reference to a SQL query that shows how to identify records who were Sent a particular email. I landed on the following ...
5
votes
2answers
151 views

Allow simultaneous writes to the same Data Extension

I have a use case where I need to bring _PushAddress data from 60 Business Units back to the Global Business Unit. For information _PushAddress has a restricted view of data available in a single ...
0
votes
0answers
111 views

How to write an sql query in marketing cloud if field name contains a reserved string?

I'm using marketing cloud for sending various marketing communication. SFMC is integrated with sales cloud. I'm facing a problem while creating a data extension which contains a field name contains ...
0
votes
1answer
70 views

SQL Convert String to Integer

In our Marketing Cloud instance we have a column that is a string and needs to be converted to an integer. I have tried the following query but get the following error: Query: UPDATE TableName ...
3
votes
1answer
60 views

False matches in a SQL query activity

I am trying to automate updates to the All Subscribers list whenever the preferred e-mail in Salesforce changes. I created a SQL query activity that compares our Salesforce data extension to the e-...
1
vote
2answers
70 views

Marketing Cloud -SQL Group BY

I have a table and I need to run some calculations on it for reporting purposes. I want to add a row that measures counts by that month. And I'm attempting to use the following statement: SELECT ...
0
votes
2answers
62 views

Very basic _click query not working

I have a very basic _click query like this: SELECT SubscriberKey FROM _Click WHERE LinkName = 'XXX' OR LinkName = 'XXX' OR LinkName = 'XXX' The XXX are ofcourse dummy text but in my query i have ...