Sunday, 22 January 2012

LINQ joins of 3 tables

Here's a LINQ query to join 3 tables (Authors, Titleauthors, Title) from the PUBS example database

from auth in Authors
join tauth in Titleauthors on auth.Au_id equals tauth.Au_id
join atitle in Titles on tauth.Title_id equals atitle.Title_id
select new { AuthorName = auth.Au_fname + " " + auth.Au_lname , atitle.Title }

No comments:

Post a Comment