作者官方网站:http://www.wxl568.cn
案例
SELECT
L.EMP_CODE AS empCode,
u.EMP_NAME As empName,
tmo.ORG_CODE as orgCode,
tmo.ORG_NAME as orgName,
tmp.POSNAME as posname,
L.EQUIPMENT_NO AS equipmentNo,
L.CLOCK_TIME AS clockTime,
L.LONGITUDE AS longitude,
L.LATITUDE AS latitude,
A.NAME AS addressName,
L.STATUS AS status,
L.REMARK AS remark,
L.OUTSIDE_CLOCK_ADDRESS AS outsideClockAddress,
L.MAC_ADDRESS AS macAddress,
L.PERSON_TYPE AS personType,
L.SYNC_STATUS AS syncStatus,
L.SYNC_TM AS syncTm ,
L.RESERVE1 AS clVersion
FROM TT_CLOCK_LOG L
inner join tm_employee u on u.EMP_CODE=L.EMP_CODE
inner join tm_org tmo on tmo.ORG_ID=u.ORG_ID
inner join ts_clock_user_org uo on uo.org_id = u.org_id
inner join tm_position tmp on tmp.POSID=u.POSITION_ID
left join TM_CLOCK_ADDRESS A on A.ID = L.ADDRESS_ID
WHERE 1=1
AND L.CLOCK_TIME >= '2017-10-11'
AND L.CLOCK_TIME <'2017-10-12'
ORDER BY L.CLOCK_TIME DESC
结果查询11号的数据
AND L.CLOCK_TIME >= '2017-10-11'
AND L.CLOCK_TIME <'2017-10-12'
查询结果也是11号的数据
AND L.CLOCK_TIME >= '2017-10-11'
AND L.CLOCK_TIME < DATE_ADD('2017-10-11',INTERVAL 1 day) 改为12号包含12号
区别是参数时间
按十分秒处理查询
select * from tt_clock_log aa where aa.CLOCK_TIME between '2017-12-19 16:00:00' and '2017-12-25 12:00:00'