Home > Net >  Exclude record if last 3 characters is some string, only if the fourth characters from the last is a
Exclude record if last 3 characters is some string, only if the fourth characters from the last is a

Time:11-17

I want to exclude data if the last 3 characters is "abc, but only if the fourth char is not "." (dot).

For example, "sdgabc" is excluded, but "sdg.abc" is included.

How can I achieve this?

RIGHT(column_name, 3) <> "abc" doesn't work because "sdg.abc" also filtered out.

CodePudding user response:

We can use a combination of LIKE here:

SELECT *
FROM yourTable
WHERE column_name NOT LIKE '           
  • Related