1

I'm currently analyzing string data and I want to view the count of specific words from a bunch of text.

I have something like these

SELECT
COUNT(text)
FROM review
WHERE text like "%hate%" or "%love%"

but it returns counts for only "%hate%". When I switched it with "%love%" first it returns only counts for "%love%". How do I write the query so that it will return the total counts for a series of words?

1 Answers1

0

You can write

SELECT    COUNT(text)
FROM review
WHERE text like "%hate%" or text like "%love%";
  • Thanks. This works. I guess if I have to return records for say 10 words, I'll have to use the OR operator 9 times. I wish there was a way I can gather all my text without adding the OR operator every time. – mike asiabaka Feb 14 '22 at 15:22