Trybbe
Hall of Fame
Points: 3967
More actions
August 5, 2008 at 6:45 am
#189033
Hi! Please help
I have a table with bi-annual ratings for staff, I want to select only the latest ratings for staff. My query is returning duplicates. here's what I wrote
select distinct(SNO), rating, Max(RATING_MONTH) as RatingMonth
from PI_All
Group by SNO, Rating
Please help
Tom257
SSChampion
Points: 11543
August 5, 2008 at 7:01 am
#853155
Is this what you're after?
SELECT SNO, Rating, Rating_Month as RatingMonth
FROM PI_ALL
WHERE Rating_Month = (SELECT MAX(Rating_Month) FROM PI_ALL)
GROUP BY SNO, Rating, Rating_Month
August 5, 2008 at 7:20 am
#853166
Thank you it is what I wanted.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply