[英]Error using the with clause I received message " Syntax error: Expected keyword AS but got "(" at [7:14]"
I am having an issue locating the error in my code我在查找代码中的错误时遇到问题
I am practicing the WITH CLAUSE IN Big Query and I am trying to create two temporary tables to eventually join我正在练习 WITH CLAUSE IN Big Query 并且我正在尝试创建两个临时表以最终加入
here is what I was able to code:这是我能够编写的代码:
WITH Total_sales as
(SELECT s.storeid,
sum(Unitprice)as sum_sale
FROM `g-mail-1234.SALES.sales_info` as s
GROUP BY storeid),
AVG_Sale (average_s_sales) as
(SELECT ROUND(avg(sum_sale),2) as average_s_sales
FROM total_sales)
SELECT * FROM total_sales as ts
JOIN avg_sale as av
ON ts.sum_sale > av.average_s_sale
but when I run the code I get a message: Syntax error: Expected keyword AS but got "(" at [7:14]但是当我运行代码时,我收到一条消息:语法错误:预期的关键字 AS 但在 [7:14] 处得到“(”
what I would like to know is:我想知道的是:
I don't believe BQ CTE syntax allows you to list the columns that the CTE will return.我不相信 BQ CTE 语法允许您列出 CTE 将返回的列。 So this line:所以这一行:
AVG_Sale (average_s_sales) as
should just be:应该只是:
AVG_Sale as
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.