'How to select unique columns for two joined tables in SQL Server [duplicate]

I am using SQL Server. I have two tables employees and employees entry times.

I am joining these tables using a LEFT OUTER JOIN. But I want to get the last input value for each employee(Last entered date).

Summary purpose

  1. Select all employee. If there is no input value corresponding to employee return null.
  2. If there are much input value corresponding, select last entered date

How do I do this?

The problem I'm having is exponentially more complex.

So simplified example for understanding;

Table 1 : Employees

Id
Name

Table 2 : Employee_Entry_Times

Id
Time_Entered
Employee_REFER


Solution 1:[1]

I think this should work.

select e.name, MAX(t.Time_Entered)
from 
employees e left outer join Employee_Entry_Times t
on e.id = t.Employee_REFER
group by e.name

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pontnou