WHERE查询到FusionTables ...(GoogleMaps v3)?

时间:2013-01-31 06:31:08

标签: google-fusion-tables

我似乎无法理解融合表查询的WHERE部分的语法。试图创建一个样式:数组(只有4个样式......)。

如果我注释掉我的查询的WHERE部分......一切都运行...但是使用WHERE查询 - 没有任何内容加载。

看起来像这样(注意:更改了名称,但没有更改标点符号):

var layer = new google.maps.FusionTables Layer({
    query:{
        select: 'geometry',
        from: 'Encrypted ID'
        where: 'ColumnName' = 'String',
    }

});

我尝试了不同语法的WHERE查询的不同种类(特别是我有一个'ColumnName',我可以链接到一个实数)。

我很困惑,我在这里出错了......我应该使用'几何'栏上的选择ROWID吗?我的操作和报价组合不好吗?...如果可以,请帮忙。

非常感谢!!!

2 个答案:

答案 0 :(得分:4)

你的WHERE子句有问题。

这是正确的:

where: "'ColumnName' = 'String'",

和顺便说一句,如果某些内容无效,你应该先检查你的javascript错误控制台......

答案 1 :(得分:2)

来自文档https://developers.google.com/fusiontables/docs/v2/sql-reference

(原始链接:https://developers.google.com/fusiontables/docs/v1/sql-reference#Select,douglasg14b根据评论更新)

<column_condition>  
Used in the WHERE clause. The syntax is: <column_name> <operator> <value>

<column_name> is described earlier in this table.

For <operator>, use one of the following with a <number>:

>, <, >=, <=, =
For <operator>, use one of the following with a <string>:

>, <, >=, <=, =
LIKE
MATCHES (equivalent to LIKE)
STARTS WITH
ENDS WITH
CONTAINS
CONTAINS IGNORING CASE
DOES NOT CONTAIN
NOT EQUAL TO
IN

我建议不要使用&lt;,&lt;,&gt; =,&lt; =,= with strings;虽然文档说你可以,但我发现它有问题。您还需要在带有空格的字符串和列名称周围使用单引号。