Replace function in SQL My-Sql Server

Replace function for display record as Active if values is 1 and In Active if  values is 0,
SELECT REPLACE(REPLACE(status,1,'Active'),0,'Inactive') AS o_status from tbl_order
Replace function for update record if values is o than update as 1 and reverse
UPDATE tbl_order SET status=REPLACE(REPLACE(REPLACE(status,'1','2'),'0','1'),'2','0')  WHERE o_id ='2'

Post a Comment

0 Comments