Guidelines for SQL queries
Writing raw SQL is an advanced operation; users are responsible for correct syntax and query results.
Follow these guidelines when using raw SQL to construct queries in a process configuration:
*
A SQL query must return a list of only the unique IDs as defined by the key on a base table.
*
SELECT DISTINCT(<key1> [<key2>,...]) FROM <table> WHERE <condition> ORDERBY <unique_id>
This query instructs the database to perform sorting and data deduplication. If you omit the DISTINCT or ORDERBY clause, Campaign sorts and deduplicates the data on the application server, so you still receive the correct results, but performance will be slower.
*
*
To significantly improve performance with large tables, use the <TempTable> token even when not using in-database optimization.
*
*
*
*
This select command must select all the relevant fields required in defining your audience level in the same order the audience level is defined.
*
No other select statements are used
*