To condense the select query I am trying to run:
A person has/can have many referrals. I am trying to display the person's most recent referral using the max() function and the corresponding referral reason. The former isn't a problem, select Person ID and max(referral date), and group by person ID.
However, I cannot display the most recent referral WITH the most recent referral's reason. The group by obviously displays both records for the unique person with the two referral reasons, rather than just one for the person. Is there a simlpe solution for this?
A person has/can have many referrals. I am trying to display the person's most recent referral using the max() function and the corresponding referral reason. The former isn't a problem, select Person ID and max(referral date), and group by person ID.
However, I cannot display the most recent referral WITH the most recent referral's reason. The group by obviously displays both records for the unique person with the two referral reasons, rather than just one for the person. Is there a simlpe solution for this?