我想离开加入两个表access_event_logs和hrm_personal_information它的工作完美。
Query is:
select concat(first_name," ",middle_name," ",last_name) as Name,
h.TIMESTAMPS,
a.PBI_ID
from
access_event_logs h LEFT JOIN hrm_personal_information a on h.USERID=a.PBI_ID
WHERE 1 group by DATE(h.TIMESTAMPS);
但是我使用运算符左连接之间的条件无法工作。
Query is:
select concat(first_name," ",middle_name," ",last_name) as Name,
h.TIMESTAMPS,
a.PBI_ID
from
access_event_logs h LEFT JOIN hrm_personal_information a on h.USERID=a.PBI_ID
WHERE h.USERID=100032 and
h.TIMESTAMPS between '2015-11-02' and '2016-11-20'
group by DATE(h.TIMESTAMPS);
我该如何解决?请帮帮我。
答案 0 :(得分:0)
作为时间戳,您需要将时间戳字段转换为日期或在比较中添加时间
喜欢
date(h.TIMESTAMPS) between '2015-11-02' and '2016-11-20'
或
h.TIMESTAMPS between '2015-11-02 00:00:01' and '2016-11-20 23:59:59'