Friday, October 25, 2013

How to: Use HAVING and WHERE Clauses in the Same Query in mysql,sql

select emp.name, sum(emp_sal.salary) as totalsalary from employee as emp left join employee_salary as emp_sal on emp.id=emp_sal.emp_idcountry='USA' GROUP by emp_sal.empid GROUP by emp_sal.empid
HAVING totalsalary>1000

No comments:

Post a Comment