mysql:全选,不重复列

jq6vz3qz  于 2021-06-21  发布在  Mysql
关注(0)|答案(1)|浏览(362)

我想选择所有列,但不重复列存储(对不起,我的英语不好)代码mysql:

SELECT * FROM store order by views DESC


这就是我想要的结果

w1jd8yoj

w1jd8yoj1#

不太清楚您想要什么,但请尝试以下操作:

select * from store s1 join (
    SELECT store, max(views) as views FROM store group by store ) s2 on s1.store = s2.store and s1.views = s2.views 
order by s1.views DESC

相关问题