Ess Kay
asked on
SQL Select distinct, where max day and year
I have a table with these fields (for simplicity)
MemberNum(int), NoteMonth (int), NoteYear(int), Notes(varchar(max))
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- -----
100000, 1 , 2014, 'ABC'
100000, 2, 2014, 'CDE'
100000, 1, 2015, 'HEL'
200000, 12, 2013, 'AFG'
200000, 5, 2014, 'MMF'
200000, 7, 2015, 'PPP'
Every month a record is added with the year, and month
I need to get the latest Notes for each member
The Query Should Return the following rows
100000, 1, 2015, 'HEL'
200000, 7, 2015, 'PPP'
MemberNum(int), NoteMonth (int), NoteYear(int), Notes(varchar(max))
--------------------------
100000, 1 , 2014, 'ABC'
100000, 2, 2014, 'CDE'
100000, 1, 2015, 'HEL'
200000, 12, 2013, 'AFG'
200000, 5, 2014, 'MMF'
200000, 7, 2015, 'PPP'
Every month a record is added with the year, and month
I need to get the latest Notes for each member
The Query Should Return the following rows
100000, 1, 2015, 'HEL'
200000, 7, 2015, 'PPP'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER