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.

Any suggestions?

  • What have you tried, and where are you stuck?
    – Kasper
    Jan 19 at 1:49

1 Answer 1


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':

FROM [data_extension]
    (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.

Not the answer you're looking for? Browse other questions tagged .