c# - .NET SQL Query joining two different tables -
i'm brand new .net mvc, , while have basic experience writing sql queries, i'm not sure how go need .net.
my initial query looks this:
var results = (from s in db.members join sa in db.focusarea on s.id equals sa.memberid sa.area == searchstring select new { s.id, s.name, s.overview }).tolist();
this not functioning correctly. seaching in s.overview reason. and, need make query more complicated. in short, have 3 tables need search across. , query, not working:
var conceptresults = (from s in db.cohorts join oa in db.outcomearea on s.id equals oa.cohortid ((oa.area.contains(searchstring)) || (oa.outcometype.contains(searchstring))) select new { s.id, s.name, s.overview }).tolist();
i need use searchstring search matches in both area , description in db.focusarea.
i need use searchstring search matches (contains) in table db.specificfocusareas column sfocusarea again join id/memberid.
is there way join or join type of statement? don't want join 3 tables because looking results either of 2 joins, not joins.
Comments
Post a Comment