Link to home
Start Free TrialLog in
Avatar of Ajit Khodke
Ajit KhodkeFlag for India

asked on

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 below table.

Id >> Name >> Sex >> Salary
1 >> A >> M >> 6000
2 >> B >> F >> 3500
3 >> C >> M >> 8500
4 >> D >> F >> 600

How should I write the query to update the values?
ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
IF is 2012 and above, and I wasn't sure what version of SQL we're on here, so I gave a CASE answer.

Ajit Khodke - Let us know if these solutions met your needs.
Avatar of Ajit Khodke

ASKER

Fixed..
Thanks  Jim and bbao for great solution.