empty ' ' if 0

Hello,

How can I return b as ' ' if the value is 0?

SELECT MyText, b=(SELECT count(*) FROM ATable)
from MyTable
johnkainnAsked:
Who is Participating?
 
gplanaCommented:
try this:

SELECT MyText, b=(SELECT CASE WHEN count(*)=0 THEN '' ELSE Count(*) END FROM ATable)
0
 
Vijaya Reddy Pinnapa ReddyCommented:
SELECT MyText, b=(SELECT CASE WHEN count(*)=0 THEN '' ELSE Count(*) END)
FROM MyTable
0
 
Vijaya Reddy Pinnapa ReddyCommented:
SELECT MyText, b=(SELECT CASE WHEN count(*)=0 THEN '' ELSE Count(*) END from ATable)
FROM MyTable
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.