如何在SOQL查询中将文本转换为数字?

时间:2018-01-08 20:42:05

标签: socrata soda

有人可以帮我弄清楚这个查询有什么问题吗?

https://data.cityofnewyork.us/resource/i4gi-tjb9.json $其中=速度< 10

失败了,错误代码为:query.soql.type-mismatch

表格的“速度”列被声明为文本。我无法将速度转换为实际(十进制)数字进行比较。感谢

2 个答案:

答案 0 :(得分:1)

尝试使用::number投射列,如下所示:

GET https://data.cityofnewyork.us/resource/i4gi-tjb9.json?$where=speed::number > 31.69

答案 1 :(得分:0)

将数字放在括号中,如下所示:

https://data.cityofnewyork.us/resource/i4gi-tjb9.json?$where=speed <“ 10”

,或者如果您需要对其进行url编码,请使用以下命令:

https://data.cityofnewyork.us/resource/i4gi-tjb9.json?$where=speed%3C%2210%22