2016-10-26 6 views
-1
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 - Operand should contain 1 column(s)..

+0

のようなものでなければなりませんあなたは、単一の列を選択する必要が – kerv

+0

サブクエリから複数の結果を得るカントあなたが追加したサブクエリの*の代わりに。 – Anandhan

答えて

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 
+0

こんにちは...問題は解決しましたか? – Webdev

関連する問題