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