-1

I'm developing an app which allows user to select the region on the map. On click of the map I'm storing that region's state and country in two separate arrays. I want to apply a query on fusion table which gives me the data for only selected states and countries.

I have tried the following two separate queries for country and state selection.

var selectState = {
                    select: 'kml_4326',
                    from: 420419,
                    where: "'name_1' IN ('Montana','Nevada')"
                };

var selectCountry = {
                    select: 'kml_4326',
                    from: 420419,
                    where: "'name_0' IN ('Canada','Russia')"
                };

Both queries works fine when I apply separately to the fusion table layer. I want to merge these two queries. I tried the following for merging but not working:

 var selectStateAndCountry = {
                        select: 'kml_4326',
                        from: 420419,
                        where: "'name_0' IN ('Canada','Russia') AND 'name_1' IN  ('Montana','Nevada')"
                    };

Please suggest me a solution. Thanks.

Programmer
  • 443
  • 1
  • 4
  • 13

1 Answers1

1

There is nothing wrong with the query, but your query didn't match any row(neither Montana nor Nevada are located in Canada or Russia).

This Query would return results:

{
    select: 'kml_4326',
    from: 420419,
    where: "'name_0' IN ('United States of America','Canada') " +
           " AND 'name_1' IN  ('Montana','Nevada')"
}
Dr.Molle
  • 116,463
  • 16
  • 195
  • 201
  • Thanks for the answer Dr.Molle. I want a query which will select some states and some country. Like in above query I want whole USA and Canada selected, and some states from other countries. – Programmer Aug 14 '15 at 10:12
  • It's not possible, this would require a `OR` -clause which currently is not supported in FusionTable-SQL . What you can do: Use 2 separate layers, 1 for the countries and 1 for the states – Dr.Molle Aug 14 '15 at 10:20
  • Can you suggest any other solution/method for this? – Programmer Aug 14 '15 at 10:21
  • I've added a suggestion to my comment above – Dr.Molle Aug 14 '15 at 10:22