U-sql 错误:预期为:除了具有相交选项顺序外联合并集的组,其中";)","



>我有一个下表:

EstimatedCurrentRevenue -- Revenue column value of yesterday
EstimatedPreviousRevenue  --- Revenue column value of current day
crmId
OwnerId
PercentageChange.

我正在查询 Azure 数据湖中类似结构化数据的两个快照,并尝试查询收入的百分比变化。

以下是我尝试在 OpportunityId 上加入以获取收入值之间的差异的查询:

@opportunityRevenueData = SELECT (((opty.EstimatedCurrentRevenue - optyPrevious.EstimatedPreviousRevenue)*100)/opty.EstimatedCurrentRevenue) AS PercentageRevenueChange, optyPrevious.EstimatedPreviousRevenue, 
opty.EstimatedCurrentRevenue, opty.crmId, opty.OwnerId From @opportunityCurrentData AS opty JOIN @opportunityPreviousData AS optyPrevious on opty.OpportunityId == optyPrevious.OpportunityId;

但是我收到以下错误:

E_CSC_USER_SYNTAXERROR:语法错误。预期之一:除来自 具有相交选项顺序外联合并集的组,其中 ';'')' ','

在标记"发件人"处,第 40 行

在 ### 附近:

这个表达式有我知道的问题,但不确定如何解决它。 (((选择。估计当前收入 - opty先前.估计以前的收入(*100(/选择。估计当前收入(


请帮忙,我是 U-sql 的新手

U-SQL 区分大小写(如此处所示(,所有 SQL 保留字均为大写。 因此,您应该将语句中的FROMON关键字大写,如下所示:

@opportunityRevenueData =
SELECT (((opty.EstimatedCurrentRevenue - optyPrevious.EstimatedPreviousRevenue) * 100) / opty.EstimatedCurrentRevenue) AS PercentageRevenueChange,
optyPrevious.EstimatedPreviousRevenue,
opty.EstimatedCurrentRevenue,
opty.crmId,
opty.OwnerId
FROM @opportunityCurrentData AS opty
JOIN
@opportunityPreviousData AS optyPrevious
ON opty.OpportunityId == optyPrevious.OpportunityId;

此外,如果你完全不熟悉 U-SQL,则应考虑通过一些教程来建立该语言的基础知识,包括区分大小写。 从 http://usql.io/开始。

对于(几乎?(任何USQL语法错误都可能发生同样疯狂的错误消息。 上面的答案对于提供的代码显然是正确的。

但是,由于许多人可能会通过搜索"除了具有相交选项顺序外联合联合的组"进入此页面,因此我会说处理这些问题的最佳建议是仔细查看错误消息标记为"###"的代码片段。

例如,我在收到长查询的语法错误时进入此页面,结果发现我没有大小写问题,而只是一个格式错误的查询,周围有括号。 一旦我更仔细地查看代码段中###符号的位置,错误就变得清晰起来。

相关内容

最新更新