Creating raw SQL queries
Experienced SQL users can write their own SQL queries or copy and paste SQL queries from other applications. Writing raw SQL is an advanced operation; users are responsible for correct syntax and query results.
1.
2.
a.
Choose Select <audience> IDs With.
b.
Change to the Text Builder (instead of the default Point & Click method).
c.
Click Advanced.
d.
In the Advanced Settings dialog, check Use Raw SQL for Record Selection. This option enables the use of raw SQL in the Text Builder when you specify your selection criteria. If you do not select this option, you can only use IBM® EMM expressions and Custom Macros.
e.
Select a data source to query from the Database list. Select the target audience from the Audience Level list.
f.
If you want to run SQL commands before or after the Select process, you can specify raw SQL in the Pre-Processing or Post-Processing area. See Specifying pre- or post-processing SQL statements.
g.
Click OK to close the Advanced Settings dialog.
h.
Enter raw SQL in the text entry area. You can use the Formula Helper to help construct the SQL. Check SQL in the Formula Helper to restrict the list of operators and functions to SQL-specific options.
3.
a.
Choose Segment by Query, then create or edit a segment.
b.
Choose Select IDs With, click Text Builder, then click Advanced.
c.
In the Advanced Settings dialog, check Use Raw SQL, select a data source, and click OK.
d.
Enter raw SQL in the text entry area. Optionally, use the Formula Helper to help construct the SQL. Check SQL in the Formula Helper to restrict the list of operators and functions to SQL-specific options.
Guidelines for SQL queries
Specifying pre- or post-processing SQL statements
Using the TempTable and OutputTempTable tokens in raw SQL queries
Referencing Extract tables in raw SQL queries
How queries are evaluated in Campaign processes