Example:
wordrr -> Incorrect because it have 3 'r'
word --> Correct becouse it not have 3 'r'
Example:
wordrr -> Incorrect because it have 3 'r'
word --> Correct becouse it not have 3 'r'
You want to fetch those rows in which a specified column doesn't contain the character "r" 3 times.
Here is the code to count the occurrence of character "r".
SELECT (LENGTH(ColName) - LENGTH(REPLACE(ColName, 'r', ''))) as "R Count" from TableName;
Note: If LENGTH doesn't work, try using LEN.
Now in order to fetch rows which doesn't have character "r" occurring 3 times or more
SELECT * from TableName where (LENGTH(ColName) - LENGTH(REPLACE(ColName, 'r', ''))) < 3 ;
Also you can use:
SELECT * from TableName where (char_length(ColName) - char_length (REPLACE (ColName, 'r', ''))) <= 3 ;