TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abdul Amin Khan
1.1k
605
21.5k
How to get Highest Sales Person in Month for Monthly Reward
Sep 13 2019 1:39 AM
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
Reply
Answers (
2
)
Issue of taking backup of a table whic has 12+crores records
Regarding performance