Nesting, grouping Sqlite syntax?

Posted by Linda on Stack Overflow See other posts from Stack Overflow or by Linda
Published on 2010-06-03T19:25:50Z Indexed on 2010/06/03 19:34 UTC
Read the original article Hit count: 416

Filed under:
|
|
|
|

I can't for the life of me figure out this Sqlite syntax.

Our database contains records like:

TX, Austin
OH, Columbus
OH, Columbus
TX, Austin
OH, Cleveland
OH, Dayton
OH, Columbus
TX, Dallas
TX, Houston
TX, Austin
(State-field and a city-field.)

I need output like this:

OH: Columbus, Cleveland, Dayton
TX: Dallas, Houston, Austin
(Each state listed once... and all the cities in that state.)

What would the SELECT statement(s) look like?

© Stack Overflow or respective owner

Related posts about sql

Related posts about sqlite