Google Fusion Table SQL query where clause - only AND works, not OR?

坚强是说给别人听的谎言 提交于 2020-02-01 05:16:24

问题


My SQL query is:

SELECT * FROM 1910640 WHERE stype='P' OR stype='ERC' OR stype='PERC' ORDER BY ST_DISTANCE(geometry, LATLNG(-0.12623619999999391,51.5001524)) LIMIT 6

This results in a "parseerror". If I replace OR with AND the query returns success:

SELECT * FROM 1910640 WHERE stype='P' AND stype='ERC' AND stype='PERC' ORDER BY ST_DISTANCE(geometry, LATLNG(-0.12623619999999391,51.5001524)) LIMIT 6

Anyone else ran into this with Fusion Tables and have a solution/workaround?

The API doc does imply only AND is allowed, which came as a big surprise to me. http://code.google.com/apis/fusiontables/docs/developers_guide.html#Querying


回答1:


OR isn't supported - look at the API ref filter_conditions

IN is supported - so you can IN all your OR conditions for SType




回答2:


Excuse me if I'm saying foolery, since I never have use fusion-tables, but OR queries can be split into 2 queries, one for each condition.

The main problem in this workaround is that you must implement the ORDER in programming language when merging both queries.




回答3:


You can use IN instead of OR because OR is not supported by fusion tables.

http://www.w3schools.com/sql/sql_in.asp



来源:https://stackoverflow.com/questions/7904069/google-fusion-table-sql-query-where-clause-only-and-works-not-or

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!