Try something like shown below. I may not have all the columns correctly, but the basic idea is the following:1. You start with the Employee table and pick up all the columns you want.2. You use an OUTER APPLY to pick up just one row from the shoplogin table. Which row you pickup is determined by the order by clause in the outer apply query.3. Do the same thing for the produciton table.SELECT s.loggeddate, s.loggedshift, s.entrytime, e.employeename , e.departmentcode , e.plantid AS EmployeePlantID, p.ProcessCode, p.EntryTime, p.CodeFROM Employee e OUTER APPLY ( SELECT TOP (1) loggedindate, loggedshift, entrytime FROM shoplogin s WHERE s.EmployeeCode = e.code ORDER BY s.loggeddate DESC, s.entrytime DESC ) AS s OUTER APPLY ( SELECT TOP (1) ProcessCode,EntryTime,Code FROM Production p WHERE p.EmployeeCode = e.code ORDER BY ProcessCode DESC ) p;