Reputation: 54113
What could I do if, say I do this:
SELECT name as "cname" from dba
But if the value of name is '0' I want cname to be = to an empty "" string.
What could I use, in standard sql to do this.
Thanks
Upvotes: 1
Views: 1493
Reputation: 4354
Use a case statement:
SELECT CASE name WHEN '0' THEN '' ELSE name END AS cname from dba
Upvotes: 3
Reputation: 175766
You could use a CASE;
SELECT
case name when '0' then '' else name end as "cname"
from dba
Upvotes: 5
Reputation: 1213
Use a case statement:
SELECT CASE WHEN name='0' THEN '' ELSE name END AS cname FROM dba
Upvotes: 2