当前位置:   article > 正文

mysql 分组取最大时间(分组取最新数据)

mysql 分组取最大时间(分组取最新数据)

select inquiry_id inquiryId,COUNT(inquiry_id) quantity, create_time  from (select * from i_inquiry_details WHERE read_status = 1 having 1 ORDER BY create_time desc) a  GROUP BY a.inquiry_id ORDER BY a.create_time DESC

select inquiry_id inquiryId,COUNT(inquiry_id) quantity, create_time  from (select * from i_inquiry_details WHERE read_status = 1 having 1 ORDER BY create_time asc) a  GROUP BY a.inquiry_id ORDER BY a.create_time asc
 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/952748
推荐阅读
相关标签
  

闽ICP备14008679号