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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:15:21+00:00 2026-05-24T09:15:21+00:00

I have a data table as follows FName SName DOB PCode Addr1 ==== ====

  • 0

I have a data table as follows

FName  SName  DOB  PCode   Addr1     
====   ==== ====== =====   =======  
Bob    Test 231280 S66TH   1 Test Lane  
Bobby  Test 240977 S66TH   2 Test Drive
Robert Test 240977 xxxxx   xxxxxx
Tim    Test 140977 S78YH   5 Hill Road

I am trying to write a function / SP that will accept Paramters FNAme, SName, Dob, PCode and Addr1. I want to be able to match records where ANY 3 out of the 5 parameters are equal. I’m not sure how to do this WITHOUT writing a long series of AND OR statements? I would quite like the solution to be scalable too so if in future another column is added then 3 out of 6 must match (or even 4 out of 6). I dont mind the query being represented by Linq either.

Essentially Im looking for a matching algorithm That can match x out of y pieces of data.

  • 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-05-24T09:15:21+00:00Added an answer on May 24, 2026 at 9:15 am

    Convert true comparisons to 1, false comparisons to 0, add them all together, and test if the sum is at least 3. Something like

    where (case FName when @FName then 1 else 0 end)
        + (case SName when @Sname then 1 else 0 end)
        + (case DOB   when @DOB   then 1 else 0 end)
        + (case PCode when @PCode then 1 else 0 end)
        + (case Addr1 when @Addr1 then 1 else 0 end)
        >= 3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table table_a with a column containing data as follows: .aaa01932 .asd02343
I have a data table as follows ID Key Value -------------------------- 1 F1 2
I have the following table: create table test ( fname char(20) character set utf8
I have data table containing one column as FilePath. FilePath D:\New folder\link.txt D:\New folder\SharepointMigration(Work
I have a data table which already has some values, plus it is getting
I have a data table filled with text in each table row. How do
I have a data Table with numbers formatted according to the current regional settings.
Ok I have a data table containing duplicate Reciept numbers and a transaction value
In my SQL Server database schema I have a data table with a date
I'm a bit confused on this. I have a data table structured like this:

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.