LINQ TO SQL 五表查询
目的实现:
var query = from P in db.Patrons join PAS in db.PatronAddresses on P.PatronNumber equals PAS.PatronNumber join PAT in db.PatronAudits on P.PatronNumber equals PAT.PatronNumber join PID in db.PatronIdentifications on P.PatronNumber equals PID.PatronNumber join PT in db.PatronTypes on P.PatronTypeId equals PT.Id select new { P.PatronNumber, P.PrimaryName_GivenName, PAS.PostCode, PAT.AuditID, PID.ExpiryDate, PT.PatronTypeName }; if (null != query) { foreach (var item in query) { //Console.WriteLine(item); } }