0

I have table like Which has column A & B

      A            B
      1            9
      1            8
      2            7
      2            5

I want to write query.

  Select case when B = 9 then A = 'X', when A = 2 then 'Y' end as A

Is it possible in SQL. Please guide me

sk7730
  • 636
  • 3
  • 9
  • 32

1 Answers1

0

Try this:

SELECT  
    CASE WHEN B = 9 THEN 'X'
         WHEN A = 2 THEN 'Y'
    END ,
    A ,
    B
FROM    dbo.tblTest;
Vahid Farahmandian
  • 6,081
  • 7
  • 42
  • 62