Question: I have a database created using Ruby-on-Rails. What I require is a model (perhaps) where I can input some information in a form and then press a button that sends emails to all the users registered in the database. The email contains the details written in the form. Is that possible? Any help will be very appreciated.

Mike

Answer: 
Consider the FROM clause as a separate part of the processing than the WHERE clause (which every product has to pretend it is, from a standards perspective).

During a LEFT JOIN, the system will take each row from the left table, and attempt to find matches in the right table. If there are matches, then it will produce one row in the output for each matching row in the right table. *If there are no matches*, then it will produce a single row, with all columns from the right table set to NULL.

In your first query, this is indeed what happens. But in your second query, during the FROM clause processing, it manages to produce a row which matches the JOIN condition:

```
3   Blue      10    3

```

So it never produces a row with NULL values for those columns from the right table.

Now, when the WHERE clause is processed, your conditions exclude this row from the final result set.

As others have said, you may be remembering the pre-ANSI join syntax, which could produce surprising results.
The `is null` check only works for `colors` that have no matching `membercolor` at all.

If any `membercolor` matches, you end up with a result set like:

```
color blue memberid 8
color blue memberid 9
color blue memberid 10

```

Applying the `where` clause filters out all blue rows:

```
memberid IS NULL OR b.memberid=11

```

If no `membercolor` matches, the result set looks like:

```
color blue memberid NULL

```

The `where` clause will allow this to pass.