I have two tables in DB from which I want to select. In one of them ‘Events’ I have events (Id, start, end, type) and in the other I have ‘Events_before_after’ where I collect events that are linked with some of the events from ‘Events’ – (Id, EventId, start, end, type).
I have also a list of ids of Events by which I need to order the events in select query.
This is what I have:
List<int> orderIds = ...
from order in orderIds
join event in events order on order equals event.id
select new DataEvent ()
{
eventId = event.Id,
start = event.start,
end = event.end,
type = event.type
}).Concat
from eventOther in Events_before_after
select new DataEvent ()
{
eventId = eventOther.Id,
start = eventOther.start,
end = eventOther.end,
type = eventOther.type
}
Is it possible to order also the second select? I mean – is there way to order it by eventId which links to ‘Events’?
What I need is:
event1
event2
eventBefore3
event3
eventAfter3
what I have is:
event1
event2
event3
eventBefore3
eventAfter3
You can do this: