输入banner图图片脚本导航/分类

mysql中between...and..的使用,及时间范围的查询

id="conCurrentCount" parameterType="map" resultType="int"> SELECT COUNT(*) FROM tbl_report_info <where> ActionTime BETWEEN #{startTime} AND #{endTime} </where> </select>

讲解:

SELECT * FROM tbl_student_info WHERE `height` between 1113 and 1122     

等同于:
SELECT
* FROM tbl_student_info WHERE `height` >= 1113 and `height` <= 1122
    SELECT * FROM tbl_student_info WHERE `createDate` between ‘20170101020304‘ and ‘20180101020304‘    
        等同于:
    SELECT * FROM tbl_student_info WHERE `createDate` >= ‘20170101020304‘ and `createDate` <= ‘20180101020304‘    

另外一种时间范围查询的方法如下:分别设定开始时间和结束时间:

<if test="endTime!=null and !&quot;&quot;.equals(endTime.trim())">
            AND m.endTime &lt; #{endTime}
        </if>
           <if test="startTime!=null  and !&quot;&quot;.equals(startTime.trim())">
            AND m.startTime &gt; #{startTime}
        </if>

 

mysql中between...and..的使用,及时间范围的查询

标签:student   范围   inf   equals   amp   post   current   test   pre