I have a column name called daily_recon I want to update it to 0 where daily_recon is #REF!. I get an error that says the column name daily_recon is ambiguous on the where statement. How do I fix this, below is the sql script? nb: using bigquery
UPDATE dataset.table1 SET daily_recon = 0 FROM `project.dataset.table1` where daily_recon ='#REF!'
Advertisement
Answer
You don’t need a FROM
clause. So:
UPDATE dataset.table1 SET daily_recon = 0 WHERE daily_recon = '#REF!';
Note: It seems strange that you are comparing daily_recon
to a string in the WHERE
clause but setting the value to a number in the SET
. Perhaps you intend '0'
in the set
.