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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:04:39+00:00 2026-05-12T14:04:39+00:00

My real-life example is too obscure to explain, but this is a pretty good

  • 0

My real-life example is too obscure to explain, but this is a pretty good approximation of what I’m trying to do…

Month table has columns: Id, Name

Holiday table has columns: Id, MonthId, DayOfMonth, Name

Appointment table has columns: Id, MonthId, DayOfMonth, Description

How do I produce a list of unique events (holidays and appointments) ordered by the month and the day of month?

Sample results:

Month  Holiday     Day  Appointment  Day
----------------------------------------
Nov                     Fly to NYC   25
Nov    T-Giving    26
Nov                     Fly home     29
Dec    Xmas        25

So, I want separate columns for holidays and events, but I want them all to be unique and listed in order of month-day.

Here’s what I have so far (see inline comments):

var events =
    from
        m in GetMonths()
    join
        h in GetHolidays()
        on m.Id equals h.MonthId
    join
        a in GetAppointments()
        on m.Id equals a.MonthId
    where
        //something that narrows all combinations of events to only unique events
    orderby
        m.Id,
        // something that interleaves h.DayOfMonth with m.DayOfMonth
    select
        new
        {
            Month = m.Name,
            Holiday = h.Name,
            HolidayDay = h.DayOfMonth,
            Appointment = a.Description,
            AppointmentDay = a.DayOfMonth
        };
  • 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-12T14:04:39+00:00Added an answer on May 12, 2026 at 2:04 pm

    Here is an alternate answer using a UNION instead of a LEFT OUTER that returns exactly the result set you are looking for (I don’t think my first answer would quite meet your “unique” requirement):

    var a = from m in month
            join h in holiday on m.Id equals h.MonthId
            select new
            {
                MonthId = m.Id,
                Month = m.Name,
                Holiday = h.Name,
                HolidayDay = h.DayOfMonth,
                Appointment = "",
                AppointmentDay = 0
    
            };
    
    var b = from m in month
            join p in appointments on m.Id equals p.MonthId
            select new
            {
                MonthId = m.Id,
                Month = m.Name,
                Holiday = "",
                HolidayDay = 0,
                Appointment = p.Description,
                AppointmentDay = p.DayOfMonth
            };
    
    var events = from o in a.Union(b)
                orderby o.MonthId, o.HolidayDay + o.AppointmentDay
                select o;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may be silly, but I'm looking for so-called 'real life' examples of software
I'm looking for a real life example on how to do something like this:
Here's a real life example I had experienced before, and this is something that
I'll explain the 'real life' application of this so it's easier to understand. I'm
Let me start from a real life example: Customer: Alex, just noticed something strange
So for example we have real life photo. how to get (relativly to image
Real noob question no doubt, but I can't get my head around this behaviour.
Can anyone suggest any real life example of Hybrid inheritance?
I have a real-life example that I have in my project below. My aim
Can someone give me a real life example ( in programming, C#) of needing

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.