时间:2021-07-01 10:21:17 帮助过:32人阅读
示例2:
<!-- 查询用户5天内的订单 create_time > DATE_SUB(now(), INTERVAL 5 DAY) 5天内,精确到秒 --> <select id="findRemoveOrder" parameterType="java.util.Map" resultMap="mapUserPartyaOrderDTO"> SELECT id,create_time,order_no,loan_id, stat,user_id,borrower_id,loan_app_id,bank_no,is_repeat_loan FROM user_partya_order WHERE 1=1 AND stat=‘6‘ AND create_time > DATE_SUB(now(), INTERVAL 5 DAY) AND loan_id =#{loanId} AND user_id=#{userId} ORDER BY create_time DESC LIMIT 1 </select>
核心标红!
mysql查询,根据时间查询:几天前、几天内的数据
标签:sql查询 apu result sql函数 更新 mysql color art style