title: Producing a report on the attendance and departure of employees
body: <p>I hope you can help me in producing a report on the attendance and departure of employees</p>
  <p>My code returns multiple rows per employee:</p>
  <pre><code> HRBakEntities db = new HRBakEntities();
  
          var AttendanceReports = db.Employees
              .Join(                    /// Source Collection  
                db.EmployeesAttendances,                        /// Inner Collection  
                p =&gt; p.Id,                                /// PK  
                p =&gt; p.EmployeeId,                                /// FK  
                (Atten, Emp) =&gt; new { MyEmployees = Atten, MyAttending = Emp })   /// Result Collection  
         .Join(                    /// Source Collection  
                db.VacationsBalances,                        /// Inner Collection  
                e =&gt; e.MyEmployees.Id,                                /// PK  
                c =&gt; c.EmployeeId,                                /// FK  
                (Emp, vbalnc) =&gt; new { MyEmployees = Emp, VacationsBalances = vbalnc })   /// Result Collection  
          .Join(                    /// Source Collection  
                db.EmployeesStatus,                        /// Inner Collection  
                e =&gt; e.MyEmployees.MyEmployees.Id,                                /// PK  
                c =&gt; c.Appointment.EmployeeId,                                /// FK  
                (a, s) =&gt; new { MyEmployees = a, MyStatus = s })   /// Result Collection  
                        .Join(                    /// Source Collection  
                db.ViolationsStatusLogs,                        /// Inner Collection  
                e =&gt; e.MyEmployees.MyEmployees.MyEmployees.Id,                                 /// PK  
                c =&gt; c.EmployeesViolation.EmployeeId,                                /// FK  
                (a, b) =&gt; new { MyEmployees = a, viStat = b })   /// Result Collection  
  
            .Select(a =&gt; new AttendanceReport
            {
                EmployeeCode = a.MyEmployees.MyEmployees.MyEmployees.MyEmployees.Code,
                FullNameAr = a.MyEmployees.MyEmployees.MyEmployees.MyEmployees.FullNameAr,
                WorkStatusType = a.MyEmployees.MyEmployees.MyEmployees.MyEmployees.WorkStatusType.NameEn,
                EmployeesShifts = a.MyEmployees.MyEmployees.MyEmployees.MyAttending.Shift.NameEn,
                ShiftTimeIn = a.MyEmployees.MyEmployees.MyEmployees.MyAttending.ShiftTimeIn.ToString(),
                TimeIn = a.MyEmployees.MyEmployees.MyEmployees.MyAttending.TimeIn.ToString(),
                ShiftTimeOut = a.MyEmployees.MyEmployees.MyEmployees.MyAttending.ShiftTimeOut.ToString(),
                TimeOut = a.MyEmployees.MyEmployees.MyEmployees.MyAttending.TimeOut.ToString(),
                WorkHourse = a.MyEmployees.MyEmployees.MyEmployees.MyAttending.WorkHourse,
                EmployeesAttendances = a.MyEmployees.MyEmployees.MyEmployees.MyAttending.LateTime.Value,
                EmployeesLocations = a.MyEmployees.MyEmployees.MyEmployees.MyEmployees.LocationId,
                EmployeesViolations = a.viStat.EmployeesViolation.Penalty.NameAr,
                FixedAttendancesLogs = a.MyEmployees.MyEmployees.VacationsBalances.BalanceDue,
                VacationsBalances = a.MyEmployees.MyEmployees.VacationsBalances.CurruntBalance,
                CompanyBranche = a.MyEmployees.MyEmployees.MyEmployees.MyEmployees.CompanyBrancheLocation.CompanyBrancheId,
                Section = a.MyEmployees.MyEmployees.MyEmployees.MyEmployees.CompanyBrancheLocation.CompanyBrancheId.ToString(),
            })
            .Take(5)
             .ToList();
  </code></pre>
  <p>My code returns multiple rows for each employee and I need one row with all the data grouped.
  Thank you everyone</p>