SQL/mysql - Select distinct/UNIQUE but return all columns?

前端 未结 18 1093
忘掉有多难
忘掉有多难 2020-11-22 12:08
SELECT DISTINCT field1, field2, field3, ......   FROM table

I am trying to accomplish the following sql statement but I want it to return all colum

18条回答
  •  余生分开走
    2020-11-22 12:42

    Try

    SELECT table.* FROM table 
    WHERE otherField = 'otherValue'
    GROUP BY table.fieldWantedToBeDistinct
    limit x
    

提交回复
热议问题