Jason Quick
Jason Quick

Reputation: 5

How to check for spaces in LIKE statement PostgreSql?

Working on a query that filters out results that have a document with a title of Posting Notice - Expires 2019-06-01. There will be various text before and after.

PostgreSQL query:

WHERE title LIKE '%Posting Notice - Expires 2019-06-01%'

However, learned that spaces can't be used in a LIKE clause. How can I fix my query with LIKE clause to filters out results with this full title?

Resulting table should only include results that do not have this title as to figure out which ones need to have this document. Not sure if I need to do this all in a CASE WHEN clause or in a WHERE clause.

Upvotes: 0

Views: 234

Answers (1)

justcode
justcode

Reputation: 1582

Just add a NOT to your query:

WHERE title NOT LIKE '%Posting Notice - Expires 2019-06-01%'

Upvotes: 1

Related Questions