Dear All,
I have a SQL question not able to get exact record.
How to get Monthly Highest Sales Person in given record.
Please tell me where I am wrong.
Employee Table:
Sales Table:
Expected Result:
Tried Query:
With Temp AS(
Select e.empID,SUm(s.Sale) as Sale,s.monthname
From tblEMp e inner join tblSales s on e.empID=s.empID
Group by s.monthname,e.empiD)
Select Distinct(Sale),empID,monthName from Temp Where Sale in (Select Max(Sale) from Temp Group by monthName)
Group by monthName,empID,sale
order by monthname
2 Replies
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.
Amit MohantyPosted Sep 13, 2019, 2:47 AM
Abdul Amin KhanPosted Sep 17, 2019, 12:25 AM