Avatar of Ajit Khodke
Ajit Khodke
Flag 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?
Microsoft SQL ServerDatabases

Avatar of undefined
Last Comment
Ajit Khodke

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Jim Horn

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
bbao

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Jim Horn

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.
Ajit Khodke

ASKER
Fixed..
Thanks  Jim and bbao for great solution.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes