我已经开发了一个考勤管理系统,我想通过运行以下查询来生成报告,这将是大量的行,我在共享主机上并且出现以下错误:
询问:
SELECT
`attendance`.*, `users`.`id` AS user_id,
CONCAT_WS(" ", `user_profiles`.`fname`, `user_profiles`.`lname` ) AS name,
`user_department`.`did`, `user_department`.`dep_name` FROM (`attendance`)
LEFT JOIN `users` ON `users`.`username` = `attendance`.`emp_code`
LEFT JOIN `user_profiles` ON `user_profiles`.`user_id` = `users`.`id`
LEFT JOIN `in_department` ON `in_department`.`user_id` = `user_profiles`.`user_id`
LEFT JOIN `user_department` ON `in_department`.`dep_id` = `user_department`.`did`
WHERE `banned` = '0'
AND `for_date` >= '2012-05-28'
AND `for_date` <= '2012-06-28'
ORDER BY `emp_code` asc, `for_date` asc
错误:
SELECT 将检查超过 MAX_JOIN_SIZE 行;检查您的 WHERE 并使用 SET SQL_BIG_SELECTS=1 或 SET MAX_JOIN_SIZE=# 如果 SELECT 没问题
如何使用 codeigniter SET SQL_BIG_SELECTS=1 中的活动记录运行此查询
请帮忙,我需要索引我的表吗