I would like to update a value in Redshift table from results of other table, I'm trying to run to following query but received an error.
update section_translate
set word=t.section_type
from (
select distinct section_type from mr_usage where section_type like '%sディスコ')t
where word = '80sディスコ'
The error I received:
ERROR: Target table must be part of an equijoin predicate
Can't understand what is incorrect in my query.
答案 0 :(得分:0)
您需要将不相关的子查询设置为相关子查询,
variantFilter { variant ->
def dim = variant.flavors.collectEntries {
[(it.productFlavor.dimension): it.productFlavor.name]
}
if (dim.dimensionOne == 'paid' && dim.dimensionSecond == 'someVal') {
variant.setIgnore(true);
}
}
否则,外部查询的每条记录都有资格进行更新,查询引擎会拒绝它。 Postgre(以及Redshift)评估不相关子查询的方式与SQL Server / Oracle等略有不同。