• If you look at the actual execution plan, you'll see that the nested loops (left semi join) has a warning sign. It says: "no join predicate". What basically means the execution plan is performing a join without predicate, resulting in a crossjoin or in other words, returning all the data.

    Not sure why the query doesn't error out or doesn't return no rows (which would make more sense).

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP