skip to Main Content

select Name,Marks,
case
when Marks=’65’ then Roll_num=’113′
when Marks=’68’ then Roll_num=’114′
when Marks=’71’ then Roll_num=’115′
else Roll_num
end
from student;

I Want replace Marks column with new values. in this code i am not getting marks column replace values.

2

Answers


  1. maybe so

    SELECT
    Name,
    Marks,
    CASE
    when Marks=’65’ then ‘113’
    when Marks=’68’ then ‘114’
    when Marks=’71’ then ‘115’
    ELSE Roll_num
    END FROM student;

    Login or Signup to reply.
  2. SELECT Name, Marks, 
      CASE Marks 
       WHEN '65' THEN '113' 
       WHEN '68' THEN '114' 
       WHEN '71' THEN '115' 
       ELSE Roll_num 
      END AS Roll_num 
    FROM student;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search