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/

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to