I have two tables:
Phase :
long ID
string Name
and another Activity :
long ID
string Name
long PhaseID
I already know the name of the phases and I want to get the activity for those particular phases. Do i add PhaseName to the activity table or do I do it through join in LINQ?
Maybe something like this?
var query = from a in entities.Activities
join p in entities.Phases on a.PhaseId equals p.Id
where p.Name == "Preplanning"
… and here im not sure how to finish this query..
Thanks for your help!
The code that you’ve provided will use an
Inner Jointo find all Activities where the Phase with Name “Preplanning” exists.To finish your query you need to add a select clause.
will return
IEnumerable<string>of all activity names.