页面统计想通过 天 月 年 分别来展示统计效果,

【mybatis】分别按照 天 月  年 统计查询

【mybatis】分别按照 天 月  年 统计查询

 

那么查询SQL拼接如下:

          select 
                    *,
                    
                    <if test="groupType == 1">
                        DATE_FORMAT(create_date,'%Y-%m-%d') groupDate
                    </if>
                    <if test="groupType == 2">
                        DATE_FORMAT(create_date,'%Y-%m') groupDate
                    </if>
                    <if test="groupType == 3">
                        DATE_FORMAT(create_date,'%Y') groupDate
                    </if>
                    
                FROM
                    member_count_detail
                WHERE
                    tid = #{tid}
                AND
                    DATE_FORMAT(create_date,'%Y-%m-%d') &gt;= #{satrtDate}  
                and
                    DATE_FORMAT(create_date,'%Y-%m-%d') &lt;= #{endDate}

 

相关文章:

  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
  • 2021-10-14
  • 2022-12-23
相关资源
相似解决方案