I have a SELECT statement with a LEFT OUTER JOIN that joins the employee and request tables together. I am using a LEFT OUTER JOIN because there may not be any results in the request table. It works fine, but then I try to specify two conditions on the request table and it gives me a null result. WHERE (employee.emp_id = @emp_id) AND (request.requested_time_taken = 'FALSE') AND (request.request_end_date >= GETDATE()))
Here is the complete SELECT Statement:SELECT (SELECT SUM(ISNULL(request.request_duration, '0')) AS Expr1 FROM employee LEFT OUTER JOIN request AS request ON employee.emp_id = request.emp_id WHERE (employee.emp_id = @emp_id) AND (request.requested_time_taken = 'FALSE') AND (request.request_end_date >= GETDATE())) AS dayspendingFROM employee AS employee_1 LEFT OUTER JOIN request AS request_1 ON employee_1.emp_id = request_1.emp_idWHERE (employee_1.emp_id = @emp_id)GROUP BY employee_1.emp_id, employee_1.emp_begin_accrual, employee_1.emp_accrual_rate, employee_1.emp_fname, employee_1.emp_minitial, employee_1.emp_lname
Any help on this would be greatly appreciated.Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!