I would like to select all records in the email table when it exists in the customer and preferences table (left outer join?). This must return distinct records and in the form of list(of Emails).
Dim q = From e In db.Emails Join c In db.Customers On e.email Equals c.EmailAddress Join p In db.Preferences On c.CustID Equals c.CustID Where p.condition = True 'where do I go from here? Then the list should be returned.dim emaillist as new list(of Emails)emailliist = q.tolistreturn emaillist
If I understand correctly, the default in Linq is an inner join, so you should implicitly get the rows that exist in all three tables if you join them all up. As for the distinct part, try this mod:
Dim q = From e In db.Emails Join c In db.Customers On e.email Equals c.EmailAddress Join p In db.Preferences On c.CustID Equals c.CustID Where p.condition = Truereturn q.Distinct().ToList()
At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.
Open in new window