select unique name in the mysql table

1

I have a mysql table that contains a column called Name and contains the following values:

| name Aline Alice Aline | Valdemord | Aline

and another column named ID containing it

1 | 1 | 2 | 2 | 3 | 3 |

In this case, I would like to select, for example, to search for the unique names and print each name only once, so if you have 2 Aline, just show an Aline, and in case of the values of that name. second ids table, show something from the id 1 team everyone is from ID TIME 1 all are from the RED team.

    
asked by anonymous 30.10.2017 / 09:59

1 answer

0

You have 2 options, you can use Group by and Distinct
Example with group by:

select id, nome from  tabela
    where ....
    group by nome

Example with distinct:

select DISTINCT nome, id from  tabela
    where ....
    
30.10.2017 / 11:16