mongodb中有一个Documents:
{
"_id" : ObjectId("54c955492b7c8eb21818bd09"),
"address" : {
"street" : "2 Avenue",
"zipcode" : "10075",
"building" : "1480",
"coord" : [ -73.9557413, 40.7720266 ]
},
"borough" : "Manhattan",
"cuisine" : "Italian",
"grades" : [
{
"date" : ISODate("2014-10-01T00:00:00Z"),
"grade" : "A",
"score" : 11
},
{
"date" : ISODate("2014-01-16T00:00:00Z"),
"grade" : "B",
"score" : 17
}
],
"name" : "Vella",
"restaurant_id" : "41704620"
}
我把它放到Greenplum中分析,用Json类型存储。
create table restaurant(restau json);
一些简单的查询可以用;
select restau from restaurant where restau-> restaurant_id='41704620';
但是,
select restau from restaurant where restau-> address -> zipcode ='10075';
这样为什么不行?报语法错误。