here is my table with data.
please tell me the query that how to show list of department paying total salary grater then 1500.
| emp_id | emp_name | dept_id | salary |
| 1 | James | 10 | 2000 |
| 2 | Jack | 9 | 4000 |
| 3 | Henry | 11 | 6000 |
| 4 | Tom | 9 | 8000 |
| 5 | Vicky | 11 | 7000 |
| 6 | Lora | 11 | 5000 |
| emp_id | emp_name | dept_id | salary |
| 1 | James | 10 | 2000 |
| 2 | Jack | 9 | 4000 |
| 3 | Henry | 11 | 6000 |
| 4 | Tom | 9 | 8000 |
| 5 | Vicky | 11 | 7000 |
| 6 | Lora | 11 | 5000 |
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rishikesh Kumar SinghPosted Sep 23, 2014, 3:14 AM
SELECT dept_id,SUM(salary) FROM dept GROUP BY dept_id HAVING SUM(salary)>1500
if you want only department id list then use :
SELECT dept_id FROM dept GROUP BY dept_id HAVING SUM(salary)>1500
Mark this answer as accepted if it really helps you..!!
Sunny ShaikhPosted Sep 23, 2014, 6:21 AM