Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9205329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:55:35+00:00 2026-06-17T23:55:35+00:00

I am trying to link a customer to a peferred merchant based on number

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:55:36+00:00Added an answer on June 17, 2026 at 11:55 pm

    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

    SELECT * FROM 
     (  
     SELECT deptno
          , ename
          , sal
          , RANK() OVER (PARTITION BY deptno ORDER BY sal desc) rnk 
          , ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY sal desc) rno 
          , MAX(hiredate) OVER (PARTITION BY deptno ORDER BY deptno) max_hire_date
       FROM emp_test
      WHERE deptno = 20
     ORDER BY deptno
     )
     WHERE rnk = 1
       --AND rno = 1 -- or 2 or any other number...
    /
    
    SQL>
    
    DEPTNO  ENAME   SAL    RNK  RNO HIREDATE    MAX_HIRE_DATE
    -----------------------------------------------------------
     20     SCOTT   3000    1   1   1/28/2013   1/28/2013
     20     FORD    3000    1   2   12/3/1981   1/28/2013
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a customer/partner who's trying to link their application with ours using our
Im trying to link my program to the shared library. Im using a makefile
I am trying to link to an external link using the anchor tag like
I'm trying to link a 2d list of objects to a contentcontrol. I'm getting
i am trying to link a Unity game to a Java server using C#
I'm trying to link two tables in the same database using a third. The
I am trying to link a remote database to a local database using dblink.
I am trying to link the button with my all games in amazon app
I am trying to link up a redis database with a Node.js application I
I'm trying to link to an external stylesheet using this code: <?php include(/homepages/9/myusername/htdocs/Mobile_Detect.php); $detect

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.