
Please tell me what is the query?

3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

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
Jayraj ChhayaRank #304 · 8.2K reputationPosted Sep 3, 2022, 11:51 AM EDT
Please see the below query .
SELECT de.CompId,c.Name
,COUNT(de.deptId) AS TotalDept,COUNT(de.empId) AS TotalEmp
,MAX(CONVERT(INT, e.Salary)) AS MaxSalary
FROM DeptEmp AS de
INNER JOIN Companies AS c ON de.CompId = c.CompId
INNER JOIN Departments AS d ON de.DeptId = d.DeptId
INNER JOIN Employees AS e ON de.EmpId = e.compId
GROUP BY de.CompId,c.Name,de.deptId,de.empId
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Sep 3, 2022, 8:29 AM EDT