Tuesday, November 21, 2017

SQL query swap column values

In this lesson, we discuss how to swap data into the same column in the same table. This is table name welog.Table raw data are given below for your understanding purpose.




Query:

UPDATE  welog
SET Divison =(CASE WHEN Divison = 'B' THEN  'A'  WHEN  Divison = 'A'  THEN  'B'  END  )

Result:




No comments:

Post a Comment