0

im using Like to select all data which has single quote in name like Jon's.

select * from users where file_name like '%'%';

I then want to remove the ' from all results.

Ideas?

1
  • Do you mean single apostrophe, ' , or the backtick ` ? Commented Dec 9, 2013 at 8:32

1 Answer 1

2

Double quotes in SQL to escape them:

select * from users where file_name like '%''%';

(For any vaguely recent PostgreSQL version; the non-standard escape-string phrasing E'%\'%' will work with even very old PostgreSQL versions, but not other databases.)

It sounds like you want to remove those characters from the file names. If so, something like the untested:

update users
set file_name = replace(file_name, '''', '')

should do the trick.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.