0 votes
1 view
in SQL by (40.3k 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.3k 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 (22.4k points)
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...