So I have this table wherein it has columns named AMEX and CashOnly. Both of them have values of either 1 or 0. Now, instead of 1 and 0, I want to change all the '1' values to 'YES' and all the '0' values to 'NO' so it would be much more understandable to the viewer.
What is the most efficient SQL query I could use to accomplish this?
Use a single
UPDATE yourTable SET AMEX = CASE WHEN AMEX = '0' THEN 'NO' ELSE 'YES' END, CashOnly = CASE WHEN CashOnly = '0' THEN 'NO' ELSE 'YES' END
Note that this assumes that you have converted your
CashOnly columns to
VARCHAR. Also note that there is no
WHERE clause because you want to update all records in your table.