Fusion Tables distintas

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.

Condado de 1

ciudad 1

ciudad 2

Condado de 2

ciudad 3

ciudad 4


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'

Cualquier ayuda muy apreciada. Gracias

preguntado el 10 de julio de 12 a las 15:07

1 Respuestas

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


Respondido 10 Jul 12, 17:07

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.