获取子查询返回的行数超过1,但我想按多个日期获取访问次数
SELECT COUNT('visit') as total_visit1,employee_id,
(SELECT COUNT('visit') as total_visit2 from employee_meeting
WHERE visit_date between '2018-07-29' and '2018-09-29 23:59:59.999' and employee_id='123') as total_new FROM employee_meeting WHERE visit_date between '2018-07-29' and '2018-09-29 23:59:59.999' and employee_id='123'
答案 0 :(得分:0)
尝试一下
SELECT `employee_id`,date_format(`visit_date`,'%d-%M-%Y') dt,count(*) FROM `employee_meeting` group by `employee_id`,date_format(`visit_date`,'%d-%M-%Y')