I need to write a SQL statement to find matching tags. The problem is, that in the database column the words are stored like this:
¶Klimawandel¶Ökosystem¶Moose¶CO2¶Stickstoffkreislauf¶
So if I want to find the word reis and in one column is the word Stickstoffkreislauf it will match, because reis is part of Stickstoffkreislauf.
Therefore I want to write a regex to match the 3 cases:
- starts with
¶ - ends with
¶ - starts and ends with
¶
But unfortunately I have no idea where to start with the regex because of the ¶ in the database. Does anyone have an idea how to start this? Thank you!
Here is my statement so far:
SELECT DISTINCT csia.cID, csia.ak_tags, p.cParentID, cv.cvName
FROM CollectionSearchIndexAttributes csia
JOIN Pages p ON csia.cID = p.cID
JOIN CollectionVersions cv ON csia.cID = cv.cID
WHERE cv.cvisApproved = '1'
AND csia.ak_tags like '%reis%'
The column I'm looking for is csia.ak_tags.
¶ is unicode 00B6
¶at the beginning or ending of the data.