[英]Error when trying to use update value in Bigquery sql
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?我有一个名为 daily_recon 的列名,我想将其更新为 0,其中 daily_recon 是 #REF。我收到一个错误,指出 where 语句中的列名 daily_recon 不明确,我该如何解决? below is the sql script: nb: using bigquery下面是 sql 脚本:nb:使用 bigquery
UPDATE dataset.table1 SET daily_recon = 0 FROM `project.dataset.table1`
where daily_recon ='#REF!'
You don't need a FROM
clause.您不需要FROM
子句。 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
.注意:您将daily_recon
与WHERE
子句中的字符串进行比较,但将值设置为SET
中的数字,这似乎很奇怪。 Perhaps you intend '0'
in the set
.也许您打算在set
中设置'0'
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.