$sql="SELECT employee as SME, department, employee_title as title, SUM(w2_wages) as wages FROM employees e WHERE e.SME=1 AND e.department= (SELECT department FROM employees WHERE e.campaign='$campaign' AND e.email='$email' AND SME=1)";
I have a table called employees. Some of the employees are SME's. For each SME I'd like to total the w2_wages for everyone who in their same department. The error I am getting Message: Query Error >> [Subquery returns more than 1 row] . Any idea how to fix this?