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

  • Home
  • SEARCH
  • 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 8916753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:19:22+00:00 2026-06-15T05:19:22+00:00

I have table that has multiple data for the same Id. I need to

  • 0

I have table that has multiple data for the same Id. I need to combinations on this data.

For example this the table contain

ID    Visit DAte       Visit number    Rational 
-----------------------------------------------
1     14/05/2011           1           new
1     15/06/2012           2           Emergency 
1     17/07/2012           3           Check-Up

up to 20 visit

The result that I want is like this

ID    Visit DAte       Visit number    Rational 
-------------------------------------------------
1     14/05/2011           1           new
1     15/06/2012           2           Emergency 
1     17/07/2012           3           Check-Up

1     14/05/2011           1           new
1     15/06/2012           2           Emergency 
1     19/07/2012           4           follwo-up

1     14/05/2011           1           new
1     15/06/2012           2           Emergency 
1     18/12/2012           5           Check-Up

etc.... 

The last one will be

1     14/01/2011           18          Referral 
1     15/02/2012           19          Check-up
1     18/10/2012           20          Emergency

Can I do this by query?

//– I define a class and I define a list from that class

public struct ACVsize5
{
    public int ID;
    public DateTime date;
    public int RaId;
    public int HpId;
    public int DgId;
    public int VisitNum;
}

List<ACVsize5> patient = new List<ACVsize5>();

I used this quer but this select two value but i need to get 3 or more

var query = patient.SelectMany((value, index) => patient.Skip(index + 1),
                          (first,second) => new { first, second });

//– edit

I have to check the combination for one patient to match it with other 4 patients

I came up with generate the first combination if it is match i continue to generate the rest but this operation took long time process how i can increase the performance for the code below ?

for (int j = 0; j < 10000; j++)
        {

            int id1 = getid(names[j].ToString(), 10000);

            for (int t = 0; t < 10000; t++)
            {
                generate_firstACV5A(id1, nvisit(id1), names[j].ToString());

                int id2 = getid(names[t].ToString(), 10000);
                if (id1 == id2) { }
                else
                {
                    generate_firstACV5B(id2, nvisit(id2), names[t].ToString());

if (comparefirst()==true)
                    {

if (count == 0)
                        {
                            safecount++;
                            if (safecount == 4) break;
                        }
  • 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-15T05:19:23+00:00Added an answer on June 15, 2026 at 5:19 am

    Here’s some example code that will generate sets of 3. I don’t know how an ORM will handle this if you let it handle the querying but if you have it locally as objects.

    var queried = ... // example:  Enumerable.Range(1, 20).Select(n => new { FK = n });
    
    var sets =
        from a in queried
        from b in queried
        from c in queried
        where a.FK < b.FK && b.FK < c.FK
        select new { a, b, c };
    

    Using your code:

    List<ACVsize5> patient = ... // filled by you but I assume a single unique ID
    
    var sets =
        from a in patient
        from b in patient
        from c in patient
        where a.VisitNum < b.VisitNum && b.VisitNum < c.VisitNum
        select new {a, b, c}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that has multiple entries to the same table, the problem
i have a stored procedure that has to retrieve data from multiple tables something
I have a table that has multiple payments occuring on different dates each month.
I have a table that has multiple rows with the following fields: PersonName SongName
I have a table (participants) which has multiple columns that could all be distinct.
I have a site with multiple pages, and each page has a table that
I have a table that has duplicate email address, I need to insert just
MYSQL Database: I have a table of data that I need to put into
I have a table that has account numbers in (account_num) and user profiles (profile_id).
I have a table that has two datetime columns (one for start time and

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.