Hello, such a question has arisen, let's say I have a table id and name, there are 3 fields named Vasya, Peter, Vasya, and here's how to make a request so that it does not repeat the same names, that is, to bring Vasya Peter and all .

    2 answers 2

    SELECT * FROM 'table' GROUP BY 'column' 

    column - the column in which you do NOT need to display repetitions.

    • Thanks - dogmar
    • thumb up + accept reply best thanks. - Kenpachi
    • grouping is not invented for this. distinct correct answer - renegator
     select distinct name from table 

    If an id is needed, then a clarification is required of which washi you should get it from. If the first, then so:

     select min(id), name from table group by name 
    • and if the second? - dogmar
    • Then max (id). And if you need a specific Vasya, then by id and select it. :-) - msi