提取 STRUCT 数据类型 Redshift Spectrum 中的元素

问题描述 投票:0回答:1

我有一个具有以下模式的频谱表:

TABLE spectrum.table (
    realmcode struct < @code: string >,
    typeid struct < @extension: string,
    @root: string >,
    templateid struct < @root: string >,
    id struct < @assigningAuthorityName: string,
    @extension: string,
    root: string >
) 

我想提取 assigningAuthorityName 字段 id 结构

示例:

{"@assigningauthorityname":"BBBB","@extension":"CCCC","@root":"2.16.840.1.113883.2.9.4.3.8"}

我运行以下sql

SELECT  c.id.@assigningAuthorityName
 FROM "spectrum"."table" c

它给了我“上下文“.id.@”中“@”处或附近的语法错误

如果我跑步

SELECT  c.id.assigningAuthorityName
 FROM "spectrum"."table" c

**它给我返回一个 NULL 值 **

我该如何解决? 谢谢你

database error-handling amazon-redshift amazon-redshift-spectrum
1个回答
0
投票

用引号将其括起来,就像其中包含大写字母一样

SELECT  c.id.”@assigningAuthorityName”
 FROM "spectrum"."table" c
© www.soinside.com 2019 - 2024. All rights reserved.