I have a table with 18 columns (all Ints) and 1040 rows. If any value is zero I want to change it to 1. I am using Postgresql. What is the best way to do this. I cannot come
How about this
UPDATE table SET columnA = 1 WHERE columnA = 0
But you will need a query for each column, or
UPDATE table SET columnA = CASE WHEN columnA = 0 THEN 1 ELSE columnA END, columnB = CASE WHEN columnB = 0 THEN 1 ELSE columnB END, ...