Loading
Salesforce now sends email only from verified domains. Read More
Journeys and Automations in Marketing Cloud Engagement
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Build a SQL Query Activity

          Build a SQL Query Activity

          In Automation Studio, build a SQL query activity that retrieves the data that you’re interested in, and then add it to an automation.

          Before you begin, create a data extension to store the query results.

          1. Click Activities.
          2. Click Create Activity.
          3. Select SQL Query.
          4. Enter query properties, such as name, external key, and description.
          5. Click Next.
          6. Write a SQL query.
            • To see data extensions in your account that you can query, click a folder.
            • To add all columns from a data extension, double-click the data extension or drag it into the query. Remove the extra comma that appears after the final column name.
            • To add a single column, double-click the column name or drag it into the query. Remove the extra comma that appears after the column name.
            • You can’t include both a JOIN and a SELECT * statement. Instead, write a statement that specifies each column name, even when there are multiple columns.
            Important
            Important Don’t enter column names manually, because the SQL query activity can’t identify the associated data extension. Always double-click or drag columns from the data extension list.
          7. To test the query, click Validate Syntax.
          8. Click Next.
          9. Choose a target data extension to store the query results. The target can’t be a data extension that you used in the query.
          10. Select how the query activity writes data to the target data extension.
            • Append—New data is added to the end of the target data extension. Existing data isn’t updated.
            • Update—Matching data in the target data extension is updated. New data without a match is added to the end of the target data extension.
            • Overwrite—All existing data is deleted from the target data extension and replaced with new data.
          11. Save the activity.
          12. Start or run the activity from the Activities page or include it in an automation.
            The query’s output is stored in the target data extension. You can view the results of each query’s run in the activity’s action log.
           
          Loading
          Salesforce Help | Article