Saturday, 12 July 2014

Swapping the values

Swapping the values

I have the data in the table with their gender's reversed as below.We need to regain .

Input Tablename: SWAP                                                                                  Output:SWAP
UPDATE SWAP 
SET GENDER=CASE
WHEN GENDER='M' THEN 'F' 
WHEN GENDER='F' THEN 'M'
END;

No comments:

Post a Comment