when select from mysql remove duplicate names

Discussion in 'PHP' started by tastro, Apr 9, 2009.

  1. #1
    hi,

    also... like said in the title i need a php script that removes duplicate names when reading/select from mysql.

    also that it won't output/return/print 2x the same name, for example:

    if i have 2x john in my mysql john mclane and john travolta.
    but i want only one john to be printed out.

    thank you, tastro
     
    tastro, Apr 9, 2009 IP
  2. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #2
    I think you're probably looking for

    GROUP BY [field name]

    where field name is the name of the field that contains names.
     
    Weirfire, Apr 9, 2009 IP
  3. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #3
    SELECT DISTINCT(field) ?
     
    matthewrobertbell, Apr 9, 2009 IP