www.webdeveloper.com
Results 1 to 3 of 3

Thread: MYSQL Show Repeating Data Once

  1. #1
    Join Date
    May 2009
    Location
    Rochester, NY
    Posts
    364

    Question MYSQL Show Repeating Data Once

    Ok, I'm a little rusty with MySQL. Let's say I want to show all my data in a database column but I want to only show it once.

    Example:
    Code:
    ZIP       ADDRESS
    12345       Smith St.
    12345       Oak St.
    14445       Marble Ave.
    If I do a SELECT * FROM table, I will get 12345, 12345, and 14445. However, I just want it to report 12345 once. How do I do that?

    Thanks.

  2. #2
    Join Date
    May 2009
    Location
    Rochester, NY
    Posts
    364
    Ok, I answered my own question.

    SELECT DISTINCT * FROM table

    I couldn't find the answer because I had trouble with the phraseology.

    Thanks multimediocrity!
    You're welcome multimediocrity!

  3. #3
    Join Date
    Mar 2006
    Location
    Discworld
    Posts
    75
    Wrong.
    If you do SELECT DISTINCT * FROM table you will still end up with 12345 show up twice simple because second value in that record is not the same as a first one.
    You need "SELECT DISTINCT ZIP FROM table" only that will give you unique values from ZIP column.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles