mysql取內容時先order by后group by


在mysql里取數據時怎么先order by后group by?其實很簡單,sql語句如下:

select count(count_filed) from (select * from table order by order_by_filed) table group by group_by_field;

這樣就可以實現對group by里的內容排序,按你的意思先order by后group by!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM