SQL searching text with two identifiers

I have multiple rows in my table that I need to delete.

Lines to be deleted have lines with two in them "***"

, for example "This is a ***example of *** a bad row"

.

How can I get SELECT

these lines so I can check them and delete them later?

I know I can use SELECT * FROM table WHERE column LIKE '%***%'

, but also selects rows with one "***"

in them (rows to be deleted have two in them "***"

).

Thank!

+3


source to share


1 answer


SELECT * FROM table
WHERE column LIKE '%***%***%'

      

This, however, will also remove any lines where there are three or more "***"

. If you don't want this, you can do



SELECT * FROM table
WHERE column LIKE '%***%***%'
  AND column NOT LIKE '%***%***%***%'

      

+4


source







All Articles