distinct 单个字段 解决方案


 

 

 

 

 

select 要使用字段1,要使用字段2 from 表名 where id in (select min(id) from 表名 group by 不重复字段名)
例:
  select byid,id from bbs where id in (select min(id) from bbs group by byid)

select * from table where id in (select min(id) from table group by a,b,c)
 
 
引用
https://www.cnblogs.com/q149072205/p/4318133.html 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM