How to match a backslash with the like operator in Redshift

Viewed 49

How can I match a backslash with the like operator in Redshift?
I tried below, but they didn't work…

-- syntax error
select 'a\a' like '\';

-- false
select 'a\a' like '\\';

-- syntax error
select 'a\a' like '\\\';

-- syntax error
select 'a\a' like '\' escape '^';

-- syntax error
select 'a\a' like '^\' escape '^';
1 Answers

Envelope it with %:

select 'a\a' like '%\\%';

enter image description here

Related