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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rishikesh Kumar SinghRank #1,250 · 1.4K reputationPosted Sep 22, 2014, 11:14 PM EDT
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 Shaikh50 reputationPosted Sep 23, 2014, 2:21 AM EDT