Forum Moderators: coopster

Message Too Old, No Replies

mysql display problem

         

smatts9

3:12 am on Mar 11, 2006 (gmt 0)

10+ Year Member



I have a table with a bunch of junk in it, and one of the columns is 'city', and for instance I go to list all of the available cities in a state where the item is, state is also a column, and it will go down the database and list every city it sees. So I see a lot of Baltimore's listed.

How do I limit to only listing it once?

dreamcatcher

6:44 am on Mar 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi smatts9,

I think you may be looking for the DISTINCT clause?

SELECT DISTINCT(city) FROM table...

or maybe the WHERE clause?

SELECT FROM table WHERE city = ''..

dc

smatts9

7:01 am on Mar 11, 2006 (gmt 0)

10+ Year Member



Thank you, the DISCTINT is exactly what I needed.

inveni0

3:52 pm on Mar 11, 2006 (gmt 0)

10+ Year Member



You can also use GROUP BY `city` WHERE `State` = "Ohio"