Subject Re: [firebird-support] SQL: Restrict outer join to a subset
Author Martijn Tonies
How about...


> As title, I'm doing a left outer join to a table, but I only want
> potential matches with the table from a subset. i.e.
>
> left outer join orders o
> on o.client_id=c.client_id
>
> ......where o.OrderPlaced < '04/04/2004'

OR o.OrderPlaces IS NULL

> I can include this condition in the where clause, but that results in
> it returning zero rows should orders be empty.

Or the join like this

ON (o.client_id=c.client_id AND o.OrderPlaced < '04/04/2004')

But I'm not sure if either one works :-)

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com