SCENARIO:
Imagine a TABLE like this:
Auto_INC, UserID_FK, CaseID_FK, Date
idX userX caseX
and when it is filled, it looks like this:
id1, user4, case20, 2010/01/12
id2, user1, case13, 2010/03/20
id3, user2, case10, 2010/03/22
id4, user1, case21, 2011/01/10
id5, user2, case9, 2011/01/11
id6, user3, case20, 2011/02/01
id7, user1, case9, 2011/03/25
QUESTION:
How do i get ONE CASE Record with the LAST User Assigned ??
So if one user has been assigned, it will automatically override all previous users on that case.
Something like this:
id7, user1, case9, 2011/03/25
id2, user1, case13, 2010/03/20
id4, user1, case21, 2011/01/10
id6, user3, case20, 2011/02/01
id3, user2, case10, 2010/03/22
In this case User1 has been assigned to 3 cases, User2 to 2 cases but one was overridden by User1, User3 had 1 case and it did override User4 …so User4 does not get any case ..therefore it will NOT appear on the list.
NOTE BENE
Ideally we should be getting as result ..as many records as there are CASES on the original table !!!
Result: