Ricky wrote:
> I perform a query to get data,which contains '%'.
> so I do this query.
> select * from table where a1 like '%\%%';
> but it returns all rows.
select * from table where a1 like '%\\%%';
The first \ escapes the second \ for the string parser, the second \ is
the escape character for the LIKE pattern.
--
Peter Eisentraut
http://developer.postgresql.org/~petere/