on-clause

SQL join: where clause vs. on clause

After reading it, this is not a duplicate of Explicit vs Implicit SQL Joins. The answer may be related (or even the same) but the question is different. What is the difference and what should go in each? If I understand the theory correctly, the query optimizer should be able to use both interchangeably. ...

How do constant values effect the ON clause of Joins?

I've recently discovered that the ON clause of a LEFT JOIN may contain values such as (1 = 1). This is upsetting to me, as it breaks my perception of how joins function. I've encountered a more elaborate version of the following situation: SELECT DISTINCT Person.ID, ... FROM Person LEFT JOIN Manager ON (Manager.ID = Person.ID OR Mana...

Linq left joining with non trivial condition

This is fine, it produces a left join var q = from c in categories join p in products on c equals p.Category into ps from p in ps.DefaultIfEmpty() select new { Category = c, ProductName = p == null ? "(No products)" : p.ProductName }; But what about if I wanted to do something like this: ... on p.date between c.s...