Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in SQL by (40.7k points)

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?

1 Answer

0 votes
by (40.7k points)

If you are using SQL Server, then try this:

SELECT LEN(REPLACE(myColumn, 'N', '')) 

FROM ...

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 13, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer

Browse Categories

...