CTE的-REDSHIFT上的“ ERROR:42601:输入末尾的语法错误”

时间:2018-08-13 04:17:40

标签: amazon-redshift

我无法在下面的常见表表达式查询中找出问题。我收到错误消息

  

错误:42601:输入末尾的语法错误。

有人可以帮助我在查询中找到问题吗?

谢谢。

WITH rpt_1 AS
(SELECT count(*) as cnt, count(distinct memberid) as mem_cnt from table1),

rpt_2 AS
(SELECT count(*) as cnt, count(distinct memberid) as mem_cnt from table2);

1 个答案:

答案 0 :(得分:0)

您没有使用通过WITH关键字创建的临时表。语法如下:

with w1 as (select * from sales), w2 as (select * from supplies)
select * from w1; -- You are skipping this part, which is required