[查询时出现第一个错误 ][1]
select * from table where properties 'year' = 2007 // is not working
//please check the screen shot of the table
我想通过sql查询来查询Athena数据集。我尝试了每个查询,但它不适用于此 Athena 数据
最佳答案
我假设 properties
列是 STRING
,在这种情况下,您可以执行此操作来提取 year
字段并将其用于过滤器:
SELECT * FROM table WHERE JSON_EXTRACT_SCALAR(properties, '$.year') = '2007'
请注意,它是 '2007'
,而不是 2007
,因为从屏幕截图来看,这些值看起来像是字符串。
关于javascript - 如何在 Amazon Athena 上查询(搜索)具有 JSON 值的 sql?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55176767/