Back
I have an SQL column that is a string of 100 'Y' or 'N' characters. For example:
YYNYNYYNNNYYNY...
What is the easiest way to get the count of all 'Y' symbols in each row?
If you are using SQL Server, then try this:
SELECT LEN(REPLACE(myColumn, 'N', '')) FROM ...
SELECT LEN(REPLACE(myColumn, 'N', ''))
FROM ...
31k questions
32.8k answers
501 comments
693 users