I have this data in one table and I am trying to do a loop or a recursive method. I need to get the result base on using the meeting id. If I am using meetingid 1 it would return 2,3. If I do meetingid 2 i would get 1,3 and if I do 3 I would get 1,2. I have this method but I need to call in many time and I wanted to know if there is a better way.
MeetingId ContinuedMeetingId
---------- -------------
1 2
2 3
3 null
EF / Linq:
var y = (from m in Meetings
where m.MeetingId == MeetingId
select new
{
ContinuedMeetingsId = db.Meetings
.Where(s => s.MeetingId == m.MeetingId)
.Select(s => s.ContinuedMeetingId).FirstOrDefault()
}).FirstOrDefault();