Announcement

Collapse
No announcement yet.

UPDATE SQL statement

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • UPDATE SQL statement

    Hello friends,

    I want to update all F (female) and M (Male) values (change all F values to M and vice versa) as per following table.

    Id >> Name >> Sex >> Salary
    1 >> A >> m >> 5000
    2 >> B >> f >> 2500
    3 >> C >> m >> 7500
    4 >> D >> f >> 800

    How should I write the query to update the values?

  • #2
    Hi,
    Go through with following SQL statement

    UPDATE Gender SET sex = CASE sex WHEN 'm' THEN 'f' ELSE 'm' END

    Comment

    Working...
    X