I am trying to link a customer to a “peferred” merchant based on number of visits within the last 18 months, with the tiebreaker being the most recent visit date. I’m having a bit of trouble with the tiebreaker. If there are two records both ranked 1 based on # of visits for a certain MemberID, I want to set the IsFirst bit column to 1 on the record with the MAX(EncounterDate) for that MemberID. How should I go about doing this?
Share
This may help you… This is Oracle query based on existing emp table. I think it is a good idea to create structures when you posting a problem.
Replace first select with update etc…: UPDATE your table SET your date = max_date (max_hire_date in my example) WHERE your_field IN (select max date as in my example) AND rnk = 1 and rno = 1