Subject Re: [firebird-support] Re: left join
Author unordained
That doesn't change anything with respect to the join semantics.

select a."Nam", b."Pho" from TABLE1 a left join TABLE2 b on b."Val"=:Val and b."Pos"=:Pos and
a."ID"=b."ID_ref";

If you try to use the WHERE clause, you'll exclude possible Table1 rows that you wanted to see,
just because they joined to a Table2 row that you don't want.

-Philip

---------- Original Message -----------
From: "Gediminas" <gugini@...>
To: firebird-support@yahoogroups.com
Sent: Mon, 07 Mar 2005 22:24:34 -0000
Subject: [firebird-support] Re: left join

> send bad example, should be:
>
> select a."Nam" , b."Pho"
> from TABLE1 a
> left join (select * from TABLE2 a2 where a2."Val"=:Val and
> a2."Pos"=:Pos) b
> on a."ID"=b."ID_ref"
>
> where ID-PK in Table1, ID_ref-FK in Table2
>
> How to rewrite this query?
>
> --- In firebird-support@yahoogroups.com, "unordained"
> <unordained_00@c...> wrote:
> > select a.* from TABLE1 a left join TABLE2 b on b."Val" = :Val and
> b."Pos" = :Pos and a."ID" =
> > b."ID_ref";
> >
> > ---------- Original Message -----------
> > > have tried to make such query:
> > >
> > > select * from TABLE1 a
> > > left join ( select * from TABLE2 a2 where a2."Val" = :Val and a2."Pos"
> > > = :Pos ) b
> > > on a."ID" = b."ID_ref"
> > >
> > > it seems, that FB1.5 don't support such subqueries (memory tables),
> > > how to rewrite query to get working FB1.5 query?
>
> Yahoo! Groups Links
>
>
>
------- End of Original Message -------