SQL SELECT MAX COUNT

前端 未结 3 1930
萌比男神i
萌比男神i 2021-01-06 09:27

I have three columns in a table: id, streetname, count. To some ids is more than one streetname assinged. Count tells how often the respective street is assigned to the id.

3条回答
  •  鱼传尺愫
    2021-01-06 10:16

    I don't think it's the right way to have not unique column name 'id' but your problem should've been solved by this query:

    SELECT id, streetname FROM table ORDER BY count DESC
    

提交回复
热议问题