0
votes

I have a merged Fusion Table table that displays data from 2 other tables (county & city) that are merged on countyId . The merged table has the columns countyid,countyName,cityName

I am trying to write a query that will list the countyName once and then list each cityName within that countyName before it moves on to the next countyName.

County 1

City 1

City 2

County 2

City 3

City 4

etc.

I have the following query which returns the unique countyName just fine but I don't know how to get it to pull the cityName for each countyName.

'SELECT countyName, count() FROM table_id GROUP BY countyName'

Any help much appreciated. Thanks

1

1 Answers

0
votes

The SELECT clause lists the columns you're going to get back in the response. So try adding cityName. (You don't have to ask for the count() column if you don't need it).

SELECT countyName, cityName FROM .....

(Note, if you have multiple records for a city, you'll want to add that to the GROUP BY list too)

This should give you an answer structured like: County 1, City 1 County 1, City 2 County 2, City 3 County 2, City 4

-Rebecca