Delete repeated results from MySQL query

后端 未结 5 1824
故里飘歌
故里飘歌 2021-01-21 13:53

A MySQL query retrieves:

totalpoints --  name 
55 -- John Doe
55 -- John Doe
55 -- John Doe
55 -- John Doe
55 -- John Doe
21 -- Jean London
21 -- Jean London
13         


        
相关标签:
5条回答
  • 2021-01-21 14:18
    select name,totalpoints
    from table
    group by name
    order by totalpoints desc
    
    0 讨论(0)
  • 2021-01-21 14:22

    Very easy. use following query:

    SELECT totalpoints, name
    FROM table_name
    GROUP BY name
    ORDER BY totalpoints DESC
    
    0 讨论(0)
  • 2021-01-21 14:37
    select distinct name,totalpoints from table
    
    0 讨论(0)
  • 2021-01-21 14:39

    Please use DISTINCT keyword in your query to avoid duplicate entries

    0 讨论(0)
  • 2021-01-21 14:41

    What about using DISTINCT? Seems pretty easy... But you actually tried to google it? ou would have found it in no time.

    0 讨论(0)
提交回复
热议问题