Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Marketing Campaigns V2 Segmentation Query Reference


This document is a reference for the V2 Segmentation API. The V2 Segmentation API allows you to create and manage segments using a subset of SQL that includes statements and operations necessary to define any segment. In addition, this version of the Segmentation API exposes the contact_data and event_data tables to enable SQL-compatible queries.


General Query Format

general-query-format page anchor

_10
SELECT contact_id, updated_at
_10
FROM <table_reference> [ AS <table_alias> ]
_10
[ [ INNER ] JOIN <table_reference> ON contact_id ]
_10
[ WHERE <predicate> ]

In the previous example, the contact_id and updated_at columns are selected in the query. These two columns must be selected, and aggregate function MAX and its alias can be selected part of Last Event queries. Other than those columns, no additional columns can be selected. When joining two tables, they must be joined on the contact_id column only because it is the foreign key used to connect the contact_data and event_data tables.

All Available Query Keywords

all-available-query-keywords page anchor
  • SELECT
  • FROM
  • JOIN (defaults to INNER JOIN )
  • INNER JOIN
  • ON
  • WHERE

Query Operators for [predicate]

query-operators-for-predicate page anchor
  • [NOT] IN
  • IS [NOT]
  • AND
  • OR
  • NOT
  • =
  • >
  • >=
  • <
  • <=
  • !=
  • +
  • -
  • *
  • /
  • %

contact_data(required)

contact_datarequired page anchor
Column NameData Type
CONTACT_IDVARCHAR(36)
EMAILVARCHAR(254)
PHONE_NUMBER_IDVARCHAR
EXTERNAL_IDVARCHAR(254)
ANONYMOUS_IDVARCHAR(254)
FIRST_NAMEVARCHAR(50)
LAST_NAMEVARCHAR(50)
ALTERNATE_EMAILSVARCHAR ARRAY
ADDRESS_LINE_1VARCHAR(100)
ADDRESS_LINE_2VARCHAR(100)
CITYVARCHAR(60)
STATE_PROVINCE_REGIONVARCHAR(50)
POSTAL_CODEVARCHAR(60)
COUNTRYVARCHAR(55)
LIST_IDSVARCHAR ARRAY
CREATED_ATTIMESTAMP
UPDATED_ATTIMESTAMP
EMAIL_DOMAINSVARCHAR ARRAY
PHONE_NUMBERVARCHAR(24)
WHATSAPPVARCHAR(254)
LINEVARCHAR(254)
FACEBOOKVARCHAR(254)
UNIQUE_NAMEVARCHAR(254)
CUSTOM_FIELDS *Each custom field will appear as a column on the CONTACT table based on its name. Valid data types are: VARCHAR, NUMBER, TIMESTAMP

event_data(optional)

event_dataoptional page anchor

Event data that can be optionally be used to enhanced segments

Column nameData type
CONTACT_IDVARCHAR(36)
EVENT_SOURCEVARCHAR(256)
EVENT_TYPEVARCHAR(256)
TIMESTAMPTIMESTAMP
DATAJSON BLOB. Numeric and String type data
  • click - Whenever a recipient clicks one of the Click Tracked links in your email. In the Email History, SendGrid displays the date, time, and the URL for the link that was clicked.
  • blocked - When your IP address has been blocked by an ISP or messaging organization. Blocks are less severe than bounces and do not result in permanent suppressions: subsequent sends to blocked email addresses are not automatically suppressed.
  • bounce - The receiving server could not or would not accept the message. If a recipient has previously unsubscribed from your emails, your attempt to send to them is bounced.
  • deferred - The recipient mail server asked SendGrid to stop sending emails so fast.
  • delivered - The accepted response generated by the recipients' mail server.
  • dropped - Twilio SendGrid will drop an email when the contact on that email is in one of your suppression groups, the recipient email previously bounced, or that recipient has marked your email as spam.
  • group_resubscribe - When a recipient resubscribes themselves to a suppression group.
  • group_unsubscribe - Whenever a recipient unsubscribes from a suppression group.
  • open - The response generated by a recipient opening an email.
  • processed - Requests from your website, application, or mail client via SMTP Relay or the API that SendGrid processed.
  • spamreport - Whenever a recipient marks your email as spam and their mail server tells us about it.
  • unsubscribe - Whenever a recipient unsubscribes from your emails.

Event_Data JSON Struct Example

event_data-json-struct-example page anchor
(information)

Info

Combining more than one singlesend_id and mc_auto_id/mc_auto_step_id in a single statement using an AND clause is not allowed. In order to segment contacts that have events corresponding to more than one single sends and automations use the JOIN clause. See Multi-Engagement Events for examples.


_10
{
_10
"payload": {
_10
"unique_args": {
_10
"mc_auto_id": "02bc41ca-07f9-11eb-9c1f-422f9e0f60d1",
_10
"mc_auto_step_id": "0478e207-07f9-11eb-9c1f-422f9e0f60d1",
_10
"singlesend_id": "b1ff0108-0994-11eb-915a-7ab0feb0ce95",
_10
},
_10
},
_10
}


Supported Functions and examples

supported-functions-and-examples page anchor

Example query

current_timestamp

The following query will return all contacts that were created before this run of the segment:


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE created_at < CURRENT_TIMESTAMP

timestampadd(interval, count, timestamp)

timestampaddinterval-count-timestamp page anchor

timestampadd allows you to specify a time interval, a number of those intervals as a count, and a timestamp that you can use to compare Date fields against.

Parameters

ParameterSupported values
intervalyear, quarter, month, day, hour, minute, second
countany integer (negative or positive)
timestampA supported date/time format (RFC3339(link takes you to an external page)), an existing date field, or a custom field of type Date

Example Query

timestampadd(interval, count, timestamp)

The following query will return all contacts that were created before one year prior to 2020-10-15 6PM GMT:


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE created_at > timestampadd(day, 1, '2020-10-15T18:00:12Z')

array_contains(field_name, array)

array_containsfield_name-array page anchor

array_contains checks for at least one of the values provided in an array. It does not hard check for the presence of all the values or an exact match of the values given. It also doesn't support pattern-matches like '%gmail.com%' as array values. array_contains will instead check for the exact string, including pattern match characters. For example, when searching '%gmail.com%' the % characters are considered part of the string literal.

Parameters

ParameterSupported values
field_name"alternate_emails", "list_ids", "email_domains"
arrayalternate emails, list IDs, and email domains that correspond to the specified field_name as strings

Example Query

array_contains(field_name, array)

The following query will return all contacts with email domains equal to gmail.com or yahoo.com:


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE array_contains(email_domains, ['gmail.com', 'yahoo.com'])

contains_word(word_value, field_name)

contains_wordword_value-field_name page anchor

contains_word is a custom function provided by the Marketing Campaigns V2 Segments API. contains_word accepts two arguments: a word_value that will be searched for in the field_name values stored for each contact.

The field_name you specify must be of type Text, and the value stored in field_name must be a comma-separated string. For example, if the function evaluates the word_value alice against a first_name field where the value is bob,alice,sue, it will find alice and return the contact. However, if the first_name value is stored as bobalicesue, bob.alice.sue, or any other non comma separated string, alice will not be found, and the contact will not be returned. This is important when thinking about how to enter the string values associated with your contacts. The check is case sensitive.

  • All special characters and spaces within the comma separated string will be included when looking for a match. For Example, a field with a value of bob,(alice),sue and a match value of (alice) will return a contact
  • Single quotes in a field value must be escaped in the match value using double single quotes. For Example, a field value of bo'b,alice will require a match value of bo''b .

Parameters

ParameterSupported values
word_valueA string
field_nameAny String type fields in your contact data or custom fields. Stored strings must be comma separated.

Example Query

The following query will return all contacts where first_name contains the word bob :


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE contains_word('bob', first_name)


Sample Queries for Different Kinds of Segments

sample-queries-for-different-kinds-of-segments page anchor

Segmentation Examples From All Contacts

segmentation-examples-from-all-contacts page anchor
(information)

Info

Segmentation on a list is supported by providing a list ID value to the optional parent_list_ids field in the v2 api request. This parameter currently accepts only one list ID. Segmentation of contacts from multiple list ids is supported through the use of array_contains function. See example below.

All contacts:


_10
SELECT contact_id, updated_at
_10
FROM contact_data

All contacts with first_name 'Dave':


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE first_name = 'Dave'

All contacts where state_province_region is 'Colorado':


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE state_province_region = 'CO'

All contacts with primary email with the substring 'gmail.com':


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE email like '%gmail.com%'

All contacts with a text type custom field my_text_custom_field value 'abc':


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE my_text_custom_field = 'abc'

All contacts with primary email with 'gmail.com' as domain name, and a text type custom field my_custom_field value 'abc':


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE email like '%gmail.com' and my_custom_field = 'abc'

All contacts with a number type custom field my_number_custom_field value 12:


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE my_number_custom_field = 12

All contacts with a date type custom field my_date_custom_field value `2021-01-01T12:46:24Z':


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE my_date_custom_field = '2021-01-01T12:46:24Z'

All contacts where alternate email is equal to 'alternate@gmail.com':


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE array_contains(alternate_emails, ['alternate@gmail.com'])

All contacts where alternate email is equal to 'alternate@gmail.com' or 'alternate2@gmail.com':


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE array_contains(alternate_emails, ['alternate@gmail.com','alternate2@gmail.com'])

All contacts present in a specific list "list_id":


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE array_contains(list_ids, ['02bc41ca-07f9-11eb-9c1f-422f9e0f60d1'])

All contacts present in either of the list_ids:


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE array_contains(list_ids, ['02bc41ca-07f9-11eb-9c1f-422f9e0f60d1', '02bc41ca-07f9-11eb-9c1f-422f9e0f62e4', '042a8e48-6e31-11eb-a8bc-7656c249c550'])

All contacts with specific email domain(s) gmail.com:


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE array_contains(email_domains, ['gmail.com'])

All contacts where created_at is after 2021-01-01 12 PM GMT:


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE created_at > '2021-01-01T12:00:00Z'

All contacts where created_at is equal to 2021-01-01 12 PM GMT:


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE created_at = '2021-01-01T12:00:12Z'

All contacts with external id that starts with '123':


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE external_id like '123%'

When a contact's reserved fields are not set during creation, they default to a NULL value. Not setting a value for custom fields when creating a contact will save the contact without those custom fields. A segment query using these fields does not return contacts having NULL as a value. Additional conditions may be used to specify the field is null so that contacts having a null value will be included in the segment.

All contacts where first_name does not equal Dave, also including contacts without a value for first_name:


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE first_name != ‘Dave' OR first_name is null

All contacts where my_custom_field does not contain abc, also including contacts without a value for my_custom_field:


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE my_custom_field like ‘%abc%' OR my_custom_field is null

Only JOIN and INNER JOIN are allowed and INNER JOIN will be internally converted to JOIN. LEFT JOIN and RIGHT JOIN are restricted for performance, and the same functionality can be achieved using JOIN. The examples below show how LEFT JOIN / RIGHT JOIN can be replaced with JOIN and UNION.

The following queries return all contacts that have an event "delivered" for a particular Single Send or whose state is Colorado. While both queries return the same set of contacts, using JOIN and UNION is more performant than using LEFT JOIN.

LEFT JOIN (not supported)


_10
SELECT c.contact_id, c.updated_at
_10
FROM contact_data c
_10
LEFT JOIN event_data e
_10
ON c.contact_id = e.contact_id
_10
WHERE e.event_source = 'mail'
_10
AND e.event_type = 'delivered'
_10
AND e.DATA:payload.unique_args.singlesend_id = '042a8e48-6e31-11eb-a8bc-7656c249c550'
_10
OR c.state_province_region = 'CO'

JOIN and UNION

UNION can be used instead of "OR" to return contacts based on distinct criteria that requires use of a JOIN.

For example, a query for contacts that were 'delivered' a Single Send OR the contacts whose state_province_region is in "CO" can be written as follows:


_11
SELECT c.contact_id, c.updated_at
_11
FROM contact_data c
_11
JOIN event_data e
_11
ON c.contact_id = e.contact_id
_11
WHERE e.event_source = 'mail'
_11
AND e.event_type = 'delivered'
_11
AND e.DATA:payload.unique_args.singlesend_id = '042a8e48-6e31-11eb-a8bc-7656c249c550'
_11
UNION
_11
SELECT contact_id, updated_at
_11
FROM contact_data
_11
WHERE c.state_province_region = 'CO'

Engagement and Multi-engagement Examples

engagement-and-multi-engagement-examples page anchor

All contacts that have at least one event ( i.e. an attempt was made to send them an email):


_10
SELECT c.contact_id, c.updated_at
_10
FROM contact_data c
_10
JOIN event_data e ON c.contact_id = e.contact_id

All contacts that have opened emails from two different single sends:


_13
SELECT e2.contact_id, c2.updated_at
_13
FROM event_data e2
_13
INNER JOIN (
_13
SELECT c1.contact_id, c1.updated_at
_13
FROM contact_data AS c1
_13
INNER JOIN event_data e1 ON c1.contact_id = e1.contact_id
_13
WHERE e1.event_source = 'mail'
_13
AND e1.event_type = 'open'
_13
AND e1.DATA:payload.unique_args.singlesend_id = '02bc41ca-07f9-11eb-9c1f-422f9e0f60d1'
_13
) AS c2 ON c2.contact_id = e2.contact_id
_13
WHERE e2.event_source = 'mail'
_13
AND e2.event_type = 'open'
_13
AND e2.DATA:payload.unique_args.singlesend_id = '00163f67-7211-4363-ab4e-12dd6f313b3a'

All contacts that have opened ANY single sends within 3 days:


_10
SELECT c.contact_id, c.updated_at
_10
FROM contact_data as c
_10
JOIN event_data as e on c.contact_id = e.contact_id
_10
WHERE e.event_source = 'mail'
_10
AND e.event_type = 'open'
_10
AND e.DATA:payload.unique_args.singlesend_id is not null
_10
AND e.timestamp >= timestampadd(day, -3, current_timestamp())

All contacts that have both of the two events - click and open:


_10
SELECT e2.contact_id, c2.updated_at
_10
FROM event_data e2
_10
INNER JOIN (
_10
SELECT c1.contact_id, c1.updated_at
_10
FROM contact_data AS c1
_10
INNER JOIN event_data e1 ON c1.contact_id = e1.contact_id
_10
WHERE e1.event_source = 'mail' AND e1.event_type = 'open'
_10
) AS c2 ON c2.contact_id = e2.contact_id
_10
WHERE e2.event_source = 'mail' AND e2.event_type = 'click'

All contacts that have both of the two events - bounce and deferred for a particular automation:


_13
SELECT e2.contact_id, c2.updated_at
_13
FROM event_data e2
_13
INNER JOIN (
_13
SELECT c1.contact_id, c1.updated_at
_13
FROM contact_data AS c1
_13
INNER JOIN event_data e1 ON c1.contact_id = e1.contact_id
_13
WHERE e1.event_source = 'mail'
_13
AND e1.event_type = 'bounce'
_13
AND e1.DATA:payload.unique_args.mc_auto_id = '02bc41ca-07f9-11eb-9c1f-422f9e0f60d1'
_13
) AS c2 ON c2.contact_id = e2.contact_id
_13
WHERE e2.event_source = 'mail'
_13
AND e2.event_type = 'deferred'
_13
AND e2.DATA:payload.unique_args.mc_auto_id = '02bc41ca-07f9-11eb-9c1f-422f9e0f60d1'

All contacts that have no event data (i.e. all contacts with where there has been no attempt to send an email to):


_10
SELECT c.contact_id, c.updated_at
_10
FROM contact_data c
_10
WHERE c.contact_id NOT IN (
_10
SELECT e.contact_id
_10
FROM event_data e
_10
)

All contacts that have not opened any mail in the last two months worth of seconds from the time when the segment is run:


_10
SELECT c.contact_id, c.updated_at
_10
FROM contact_data c
_10
WHERE c.contact_id NOT IN (
_10
SELECT e.contact_id
_10
FROM event_data e
_10
WHERE e.event_source = 'mail'
_10
AND e.event_type = 'open'
_10
AND e.timestamp < timestampadd(MONTH, -2, CURRENT_TIMESTAMP)
_10
)

All contacts that have been 'delivered' the ANY single sends but have not 'open' ANY single sends within 1 month:


_14
SELECT c.contact_id, c.updated_at
_14
FROM contact_data c
_14
JOIN event_data AS e1 ON c.contact_id = e1.contact_id
_14
WHERE e1.event_source = 'mail'
_14
AND e1.event_type = 'delivered'
_14
AND e1.DATA:payload.unique_args.singlesend_id is not null
_14
AND c.contact_id NOT IN (
_14
SELECT e2.contact_id
_14
FROM event_data AS e2
_14
WHERE e2.event_source = 'mail'
_14
AND e2.event_type = 'open'
_14
AND e2.DATA:payload.unique_args.singlesend_id is not null
_14
AND e2.timestamp >= timestampadd(month, -1, current_timestamp()))
_14
)

All contacts that have been 'delivered' the second email from automation but have not 'open' the email (mc_auto_id = 'fa3e0f6e-d397-11eb-87ce-22ffc6ed50f5' mc_auto_step_id = 'fc9ead9f-d397-11eb-92fe-02aa17a6534e'):


_15
SELECT c.contact_id, c.updated_at
_15
FROM contact_data c
_15
JOIN event_data AS e1 ON c.contact_id = e1.contact_id
_15
WHERE e1.event_source = 'mail'
_15
AND e1.event_type = 'delivered'
_15
AND e1.DATA:payload.unique_args.mc_auto_id = 'fa3e0f6e-d397-11eb-87ce-22ffc6ed50f5'
_15
AND e1.DATA:payload.unique_args.mc_auto_step_id = 'fc9ead9f-d397-11eb-92fe-02aa17a6534e'
_15
AND c.contact_id NOT IN (
_15
SELECT e2.contact_id
_15
FROM event_data AS e2
_15
WHERE e2.event_source = 'mail'
_15
AND e2.event_type = 'open'
_15
AND e2.DATA:payload.unique_args.mc_auto_id = 'fa3e0f6e-d397-11eb-87ce-22ffc6ed50f5'
_15
AND e2.DATA:payload.unique_args.mc_auto_step_id = 'fc9ead9f-d397-11eb-92fe-02aa17a6534e'
_15
)

Email Activity - Last Event Examples

email-activity---last-event-examples page anchor

There are three email activities that support last events: "Last Clicked", "Last Opened", and "Last Emailed". The last event queries are helpful to see the contacts whose last mail activity is in a certain period. The following queries are used to segment contacts based on their last mail activity.

All contacts that have not opened contacts since January of 2021 (last opened activity is before 2021):


_12
SELECT c1.contact_id, c1.updated_at
_12
FROM contact_data as c1
_12
JOIN (
_12
SELECT e1.contact_id, e1.max_timestamp
_12
FROM (
_12
SELECT e.contact_id, MAX(e.timestamp) max_timestamp
_12
FROM event_data e
_12
WHERE e.event_source = 'mail' and e.event_type = 'open'
_12
GROUP BY e.contact_id
_12
) as e1
_12
WHERE e1.max_timestamp < '2021-01-01T00:00:00.000Z'
_12
) as e2 on c1.contact_id = e2.contact_id

All contacts that last clicked an email within 7 days (last clicked activity is within 7 days):


_12
SELECT c1.contact_id, c1.updated_at
_12
FROM contact_data as c1
_12
JOIN (
_12
SELECT e1.contact_id, e1.max_timestamp
_12
FROM (
_12
SELECT e.contact_id, MAX(e.timestamp) max_timestamp
_12
FROM event_data e
_12
WHERE e.event_source = 'mail' and e.event_type = 'click'
_12
GROUP BY e.contact_id
_12
) as e1
_12
WHERE e1.max_timestamp >= timestampadd(day, -7, current_timestamp())
_12
) as e2 on c1.contact_id = e2.contact_id

All contacts that were last emailed in the past three months and last opened in the previous month (last emailed is within 3 months and last opened is within 1 month):


_29
SELECT c1.contact_id, c1.updated_at
_29
FROM (
_29
SELECT c.contact_id, c.updated_at
_29
FROM contact_data as c
_29
JOIN (
_29
SELECT e1.contact_id, e1.max_timestamp
_29
FROM (
_29
SELECT e.contact_id, MAX(e.timestamp) as max_timestamp
_29
FROM event_data e
_29
WHERE e.event_source = 'mail'
_29
AND e.event_type = 'delivered' group by e.contact_id
_29
) as e1
_29
WHERE e1.max_timestamp >= timestampadd(month, -3, current_timestamp())
_29
) as e2 on c.contact_id = e2.contact_id
_29
) as c1
_29
JOIN (
_29
SELECT c.contact_id, c.updated_at
_29
FROM contact_data as c
_29
JOIN (
_29
SELECT e1.contact_id, e1.max_timestamp
_29
FROM (
_29
SELECT e.contact_id, MAX(e.timestamp) as max_timestamp
_29
FROM event_data e
_29
WHERE e.event_source = 'mail'
_29
AND e.event_type = 'open' group by e.contact_id
_29
) as e1
_29
WHERE e1.max_timestamp >= timestampadd(month, -1, current_timestamp())
_29
) as e2 on c.contact_id = e2.contact_id
_29
) as c11 on c1.contact_id = c11.contact_id

(information)

Info

NOTE: Even if the aggregate function MAX is supported along with GROUP BY, the usage is restricted to last event queries only. MAX function accepts only the "timestamp" field from event_data and GROUP BY clause accepts only the "contact_id" field. An alias name can be used only for the aggregate function MAX, but not for "contact_id" or "updated_at".

JOINing More Than 2 Data Sets

joining-more-than-2-data-sets page anchor

Multiple data sets are allowed to be joined together if done in a specific manner even though SQL supports both JOINs expressed linearly and JOINs expressed using subqueries. Each data set's criteria must be listed alongside the corresponding table reference as it makes for better readability by having the queries nested explicitly by using subqueries. Following is an example of a segment query for both types. Here, the query defines a segment of all contacts that have the event of type 'processed' from the list of contacts which have the event of type 'delivered'.

Concatenated JOINs (not supported)

concatenated-joins-not-supported page anchor

_10
SELECT c1.contact_id, c1.updated_at FROM event_data AS e2
_10
JOIN contact_data AS c1 ON e2.contact_id = c1.contact_id
_10
JOIN event_data as e1 ON e1.contact_id = e2.contact_id
_10
WHERE e1.event_source = 'mail' AND e1.event_type = 'delivered' AND e2.event_source = 'mail' AND e2.event_type = 'processed'

This logic, however, can easily be represented using JOINs with subqueries in a more readable way.


_10
SELECT e2.contact_id, c2.updated_at
_10
FROM event_data AS e2 JOIN (
_10
SELECT c1.contact_id, c1.updated_at
_10
FROM contact_data AS c1 JOIN event_data AS e1
_10
ON c1.contact_id = e1.contact_id
_10
WHERE e1.event_source = 'mail' AND e1.event_type = 'delivered') AS c2
_10
ON c2.contact_id = e2.contact_id
_10
WHERE e2.event_source = 'mail' AND e2.event_type = 'processed'

(information)

Info

NOTE: There is no reduction in functionality as both generate the exact same result.

When creating or changing a segment query using curl command, escape any single quotes present in any parameter:


_10
SELECT contact_id, updated_at
_10
FROM contact_data
_10
WHERE first_name = '\''Dave'\''


Rate this page: