常用日期函数
2023-08-14 本文已影响0人
可乐sama
--查询当日数据
select * from t_member_risk_rate where DATE_FORMAT(check_time,'%Y-%m-%d') =CURDATE()
--查询夜间(0:00-6:00)的数据
select * from t_member_risk_rate c where 1=1 and DATE_FORMAT(c.check_time,'%H')>='00' and DATE_FORMAT(c.check_time,'%H')<='05'
--查询订单金额整百的数据
select * from T_TRADE_DETAIL where 1=1 and mod(ORDER_CNY_AMOUNT, 100)=0
select * from T_TRADE_DETAIL where 1=1 and (ORDER_CNY_AMOUNT%100)=0
--查询订单金额非整数的数据
select * from T_TRADE_DETAIL where 1=1 and truncate(ORDER_CNY_AMOUNT, 0) != ORDER_CNY_AMOUNT
select * from T_TRADE_DETAIL where 1=1 and FLOOR(ORDER_CNY_AMOUNT) < ORDER_CNY_AMOUNT