How to use "CASE" keyword in SELECT statement?

Showing Answers 1 - 9 of 9 Answers

CASE expr WHEN comparison_expr1 THEN return_expr1

[WHEN comparison_expr2 THEN return_expr2

WHEN comparison_exprn THEN return_exprn

ELSE else_expr]

END

  Was this answer useful?  Yes

AVADHESH

  • Sep 30th, 2011
 

Code
  1. SELECT newsid, news,STATUS,

  2.                 case STATUS

  3.          WHEN '1' THEN 'Active'

  4.           WHEN '0' THEN 'Deactive'

  5.         END AS fieldnm

  6. FROM news ORDER BY newsid;

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions