I have a database. It contains:

ID | TAG 1 | Valera 2 | Andrey 3 | Anna 4 | Valera 5 | Anna 

I need to get only 1 TAG value regardless of duplicates:

 1 | Valera 2 | Andrey 3 | Anna 
  • four
    Possible duplicate question: SUM SQL query, how to? - Mike
  • So ^^^ only instead of sum use min to get the minimum id for the given tag - Mike

1 answer 1

There is a distinct operator to get unique values:

 SELECT DISTINCT `TAG` FROM `table`