语法错误不知道redshift或sql

时间:2016-01-24 04:01:50

标签: sql postgresql amazon-redshift

语法似乎有错误。我收到此错误

ERROR: syntax error at or near "update"
  Position: 188

update t
^

Execution time: 0.11s

有人可以帮忙。我不知道它是sql还是只是一个redshift错误(我是sql和redshift的新手)

With tbl  as
(
Select Count(1) as cnt, b.ucn 
FROM 
storiacloud.schl_storia_school_status_try b
INNER JOIN 
storiacloud.vw_storia_oms_orders a ON a.school_ucn = b.ucn 
Group By b.ucn 
) 
update t
SET no_of_orders = tbl.Cnt 
From  tbl
join storiacloud.schl_storia_school_status_try as t on t.ucn = tbl.ucn

1 个答案:

答案 0 :(得分:2)

Redshift不支持WITH ... UPDATE。

Redshift是PostgreSQL的衍生产品,但它是在PostgreSQL 8.0.2版本中分叉的。在9.1之前,没有将WITH ... UPDATE语句添加到PostgreSQL中。

请参阅:

Redshift UPDATE

PostgreSQL 8.0 UPDATE

PostgreSQL 9.1 UPDATE