I want to write an SQL query condition for a data extension field that is a STRING to not pull the ones that have the third and the last letter a specific character.
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.Sign up to join this community
You can use the
SUBSTRING function in your SQL query to extract the third and last letter of the string field and then use the
NOT LIKE operator to exclude records that have those specific characters. Here's an example of a query that excludes records where the third and last letter of the string_field are 'A':
SELECT * FROM [data_extension] WHERE (SUBSTRING(string_field, 3, 1) NOT LIKE 'A') AND (SUBSTRING(string_field, LEN(string_field), 1) NOT LIKE 'A')
You can replace the 'A' with any character you want.