Google Fusion Table SQL query where clause - only

2020-07-19 09:52发布

问题:

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