MySQL Forums
Forum List  »  Newbie

group by
Posted by: Ruddiger Topp
Date: July 19, 2005 11:27AM

i am having trouble getting this to work.

what i want is something like this

my table has 2 fields

state and city

i would like to group all the citys by state so i have a list of citys under the state

like:

Minnesota
-------------
Minneapolis
St Paul

California
-------------
Los angeles
San Diego
San Francisco

but when i do a group by i only get one city for each state

SELECT * FROM state group by state order by state

Options: ReplyQuote


Subject
Written By
Posted
group by
July 19, 2005 11:27AM
July 19, 2005 01:14PM
July 19, 2005 01:52PM
July 20, 2005 10:08AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.