找不到这个错误的地方

时间:2016-10-26 10:46:13

标签: php mysql

SELECT e.emp_id, concat(e.firstname,' ', e.middlename,' ',e.lastname) as EmployeeName  ,
(select * from mst_attendance where status='Present' AND a.current_date > '#2008-09-29%#' GROUP BY substr('emp_id',0,5)  HAVING COUNT(*)>1 ORDER BY a.emp_id='5') as PresentDays,
a.emp_id, a.current_date, a.status, a.in_time, a.out_time FROM mst_attendance a 
INNER JOIN mst_employee e ON a.emp_id=e.emp_id where e.status='active'
and e.flag='Y' and e.role='employee' and e.emp_id='5' ORDER BY a.created asc LIMIT 1

在这里,我想知道一名员工的现状。但是我得到了错误:

  

1241 - 操作数应包含1列..

1 个答案:

答案 0 :(得分:0)

而不是

(select * from mst_attendance where status='Present' AND a.current_date > '#2008-09-29%#' GROUP BY substr('emp_id',0,5)  HAVING COUNT(*)>1 ORDER BY a.emp_id='5') as PresentDays

查询应该类似于

(select column_name from mst_attendance where status='Present' AND a.current_date > '#2008-09-29%#' GROUP BY substr('emp_id',0,5)  HAVING COUNT(*)>1 ORDER BY a.emp_id='5') as PresentDays