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 7896701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:57:46+00:00 2026-06-03T07:57:46+00:00

I am struggling with the appropriate query to find duplicates while at the same

  • 0

I am struggling with the appropriate query to find duplicates while at the same time respecting the effective start and end dates for the record. Example data below.

ClientName   ClientID   EffectiveStart  EffectiveEnd
A            1          1900-01-01      2100-01-01
A            1          1900-01-01      2100-01-01
B            2          1900-01-01      2012-05-01
C            2          2012-05-01      2100-01-01
D            3          1900-01-01      2012-05-01
E            3          2012-04-30      2100-01-01
F            4          2012-04-15      2100-01-01

The output I am looking for is below.

ClientName  ClientID
A           1
D           3
E           3

The logic is that Client A has ID 1 duplicated. Client B and C have a duplicate (2) BUT the date ranges are such that the two duplicates DO NOT overlap each other, which means they should not be considered duplicates. Client D and E have ID 3 duplicated AND the date ranges overlap so it should be considered a duplicate. Client F does not have a duplicate so should not show in the output.

Any thoughts? Questions?

  • 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-03T07:57:47+00:00Added an answer on June 3, 2026 at 7:57 am

    Will need a PK

    select c1.name, c2.name, c1.id
    from client c1 
    join client c2 on c1.id = c2.id and c1.PK < c2.PK
    where c1.Start > c2.End or c1.End < c2.Start
    

    Determine Whether Two Date Ranges Overlap please give him a +1

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been struggling with this for a while and have yet to find an
I am struggling to find the appropriate function that would return a specified number
Been struggling with this for quite some time so any help is appreciated. Spent
I have been struggling with a problem for a while and so far have
Perhaps properties aren't the way to go with this, but I'm struggling to find
I'm a WPF n0ob and I'm struggling with selecting the appropriate control to get
I've been struggling with this problem, and while something elegant would be preferred any
I have been struggling with the following query: select * from table_name where contains((field1,field2),'S.E.N.S');
I am currently writing my first jQuery plugin and I am struggling to find
Hi all i have been struggling this for a while now! I have some

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.