• By the way, for anyone who wants to try how these variations cann affect the result set, here is the set of test data I used when prepaaring this question:

    CREATE TABLE dbo.Employees

    (EmployeeID int NOT NULL PRIMARY KEY,

    Name varchar(50) NOT NULL,

    Position varchar(20) NOT NULL);

    CREATE TABLE dbo.Customers

    (CustomerID int NOT NULL PRIMARY KEY,

    Name varchar(50) NOT NULL,

    SalesRep int NOT NULL REFERENCES Employees(EmployeeID));

    CREATE TABLE dbo.Orders

    (OrderID int NOT NULL PRIMARY KEY,

    OrderDate date NOT NULL,

    CustomerID int NOT NULL REFERENCES Customers(CustomerID),

    Descrip varchar(40) NOT NULL);

    go

    INSERT INTO dbo.Employees (EmployeeID, Name, Position)

    VALUES (1, 'New SalesRep', 'SalesRep'),

    (2, 'Not in sales', 'Engineer'),

    (3, 'Sales rep with active customers', 'SalesRep'),

    (4, 'Sales rep with passive customers', 'SalesRep'),

    (5, 'Former sales rep', 'Retired');

    INSERT INTO dbo.Customers (CustomerID, Name, SalesRep)

    VALUES (1, 'Active customer 1', 3),

    (2, 'Active customer 2', 3),

    (3, 'New customer 1', 3),

    (4, 'New customer 2', 4),

    (5, 'Old customer 1', 3),

    (6, 'Old customer 2', 4),

    (7, 'Customer of retired sales rep', 5);

    INSERT INTO dbo.Orders (OrderID, OrderDate, CustomerID, Descrip)

    VALUES (1, '2011-11-01', 1, 'Recent order'),

    (2, '2011-11-02', 2, 'Recent order'),

    (3, '2010-11-03', 2, 'Old order'),

    (4, '2010-11-04', 5, 'Old order'),

    (5, '2010-11-05', 6, 'Old order'),

    (6, '2011-11-05', 7, 'Recent order');

    go


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/