Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select row which has apostrophe value postgresql

I want to select rows which has apostrophe value postgresql:

select * from table where column like '%'||chr(39)||'%'

But it doesn't work.

Table buku:

id             new_issn
-------------  --------
1.003.111.641  ''
1.003.111.642  ''
1.003.111.643  125698
select * from buku where new_issn like '%'||chr(39)||'%'
like image 409
nike Avatar asked Jun 01 '11 06:06

nike


1 Answers

An apostrophe can be escaped with another apostrophe. Try this:

select * from table where column like '%''%'

Reference: Postgresql docs.

like image 117
Asaph Avatar answered Sep 24 '22 20:09

Asaph