Space
Space

Reputation: 2042

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

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

Upvotes: 4

Views: 5796

Answers (3)

Aravind S
Aravind S

Reputation: 1

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

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

Upvotes: 0

K. Bob
K. Bob

Reputation: 2688

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

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

Upvotes: 4

Fabiano Soriani
Fabiano Soriani

Reputation: 8572

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.

Upvotes: 0

Related Questions