Hi all,
Not sure how to word this but here goes.
I have a query with three tables as follows:-
What I would like to do is group the query firstly by Learn_ID, then by LPROG_ID and then show the Record within the group with the highest or maximum EENDDATE.
Not sure if i've explained myself correctly.
Thanks
Taff
Not sure how to word this but here goes.
I have a query with three tables as follows:-
Code:
SELECT [Learner Dataset].LEARN_ID, [Learner Dataset].PROVI_ID, [Learner Dataset].LSURNAME, [Learner Dataset].LFORENAM, [Learner Dataset].NAT_INSU, [Learning Programme Dataset].TYPE_LPG, [Learning Programme Dataset].TRAINING_ORG, [Learning Activity Dataset].LACTI_ID, [Learning Activity Dataset].LAIM_REF, [Learning Activity Dataset].AWARD_BOD, [Learning Activity Dataset].TITLE_LA, [Learning Activity Dataset].STARTDTE, [Learning Activity Dataset].EENDDATE, [Learning Activity Dataset].TERMDATE, [Learning Activity Dataset].COMPSTAT
FROM ([Learner Dataset] INNER JOIN [Learning Programme Dataset] ON ([Learner Dataset].PROVI_ID = [Learning Programme Dataset].PROVI_ID) AND ([Learner Dataset].LEARN_ID = [Learning Programme Dataset].LEARN_ID)) INNER JOIN [Learning Activity Dataset] ON ([Learning Programme Dataset].LPROG_ID = [Learning Activity Dataset].LPROG_ID) AND ([Learning Programme Dataset].PROVI_ID = [Learning Activity Dataset].PROVI_ID) AND ([Learning Programme Dataset].LEARN_ID = [Learning Activity Dataset].LEARN_ID)
WITH OWNERACCESS OPTION;
What I would like to do is group the query firstly by Learn_ID, then by LPROG_ID and then show the Record within the group with the highest or maximum EENDDATE.
Not sure if i've explained myself correctly.
Thanks
Taff