首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >snowflake未识别Pivot对象

snowflake未识别Pivot对象
EN

Stack Overflow用户
提问于 2019-11-20 07:12:05
回答 1查看 209关注 0票数 0

我用snowflake编写了一个SQL代码来创建一个数据透视表。我在另一个查询中使用了数据透视表的对象,但它未被识别。

代码语言:javascript
复制
create or replace table "SCRATCH"."ASHISHKUMAR".pivoted2 as
SELECT * FROM
(SELECT
  sample_number,customer_sample_number, grower, farm, field, test_parameter,result, SYM, project_id
FROM
    "SCRATCH"."ASHISHKUMAR"."PIVOTED" test
)
PIVOT(
   avg (result)
   FOR test_parameter IN ('Falling Number',
'Damaged Kernels Total',
'Alpine Screen O/100',
'Width (W)',
'Area (135 min.)',
'Absorption',
'Peak',
'Tolerance (Stability)',
'Bread Score Total (100)',
'Weight',
'Ratio No. (Max) (135 min.)',
'Area (90 min.)',
'Ratio No. (R/E) (90 min.)',
'Resistance (90 min.)',
'Shrunken & Broken',
'Wheat of Other Classes',
'Alpine Screen O/45',
'Bake Absorption',
'Crumb Color (10)',
'Digital Image Analysis',
'Max. Resistance (135 min.)',
'0/9',
'Weight (Average)',
'Water',
'Dough Temp.',
'Volume 1',
'Top Grain Score',
'Extensibility (45 min.)',
'Resistance (45 min.)',
'Hardness (Std. Deviation)',
'Moisture (Std. Deviation)',
'Dry Gluten',
'T/9',
'Diameter (Std. Deviation)',
'Weight (Std. Deviation)',
'Contrasting Classes',
'Heat Damage',
'Alpine Screen O/140',
'Bake @ 425°',
'Mix 1 (straight dough)',
'Taste (10)',
'Uniformity (10)',
'Spread Factor (W/T)',
'Ratio No. (R/E) (45 min.)',
'Proof Time',
'Extensibility (90 min.)',
'Protein',
'Test Weight (kg/hl)',
'Total Defects',
'Alpine Screen T/325',
'Ash',
'Crust (10)',
'Symmetry (10)',
'B*',
'Extensibility (135 min.)',
'1000 Kernel Weight',
'Aroma (10)',
'Volume 2',
'L*',
'Ratio No. (Max) (90 min.)',
'Ratio No. (R/E) (135 min.)',
'0/7',
'Max. Resistance (45 min.)',
'Ochratoxin A (Elisa)',
'Yield (Experimental Milling)',
'Dockage',
'Grade',
'Alpine Screen O/200',
'Thickness (T)',
'Area (45 min.)',
'Max. Resistance (90 min.)',
'Lactic Acid',
'Starch Damage',
'M.T.I.',
'Wet Gluten',
'Gluten Index',
'Vomitoxin (Elisa)',
'Foreign Material',
'Test Weight (lb/bu)',
'Moisture',
'Alpine Screen O/325',
'Bread Score:',
'Grain (20)',
'Specific Volume',
'Texture (20)',
'Resistance (135 min.)',
'Moisture (Average)',
'Sucrose',
'Amylograph',
'Fermentation Time',
'Ratio No. (Max) (45 min.)',
'Diameter (Average)',
'Loaf Height',
'Sodium Carbonate',
'Hardness (Average)',
'A*'
)
) AS GPALPIVOT order by project_id;
select * from "PARTHENON"."AGRONOMY"."INDIGO_LOT_ALL" lots left join GPALPIVOT
  on lots.id ilike GPALPIVOT.customer_sample_number
left JOIN PARTHENON.ORACLE.WHEAT_HARVEST_2019_INVENTORY inv
   on GPALPIVOT.customer_sample_number = inv.subinv_description||'_'||split_part(inv.locator,'.',1)||'-'||split_part(inv.locator,'.',2);

当我试图运行这段代码时,我得到了一个错误。PFB错误的屏幕快照:

Link of the screenshot of the error

我什么都试过了,我不知道现在该怎么办。有人能帮我解释一下吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-11-20 07:51:09

GPALPIVOT不是您创建的表的名称--它只是您在第一个查询中构造的表表达式的别名,位于原始SELECT语句的内部。后续查询中要引用的表名称应为"SCRATCH"."ASHISHKUMAR".pivoted2

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58944280

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档