$sql = "INSERT IGNORE INTO BC_PR_list_temp 0, srat.taxyear , srat.employee_email , srat.employee , srat.qualified_dollars
,e.employee_title as title,e.role as role,e.num_BC ,e.num_PR,'BC','',srat.qualified_dollars/e.num_BC as dollarsPerBC,
srat.qualified_dollars/e.num_PR as dollarsPerPR, e.business_component_string,e.project_string
FROM survey_results_activities_temp srat, employees e
WHERE campaign= ? AND email= ? AND e.employee_email=srat.employee_email AND srat.employee_email IN (SELECT srat.employee_email FROM employees WHERE FIND_IN_SET(?, e.business_component_string))";
This the current create
$sql = "CREATE TEMPORARY TABLE BC_PR_list_temp(
id int KEY AUTO_INCREMENT,
taxyear VARCHAR(10) DEFAULT '',
employee_email VARCHAR(80) DEFAULT '',
employee VARCHAR(80) DEFAULT '',
qualified_dollars int NOT NULL,
title varchar(80) DEFAULT '',
role varchar(80) DEFAULT '',
num_BC int NOT NULL,
num_PR int NOT NULL,
tipe varchar(4) DEFAULT '',
item varchar(80) DEFAULT '',
dollarsPerBC int NOT NULL,
dollarsPerPR int NOT NULL,
business_component_string varchar(120) DEFAULT '',
project_string varchar(120) DEFAULT '',
CONSTRAINT ONLYONE UNIQUE(employee_email, item, qualified_dollars)
)";