Grant Morgan wrote:
> I am having a problem with left joins in Postgresql.(probably my
> misunderstanding of left joins)
>
> My first Query returns
> 70,000
>
> select count(*)
> from h
> where h.tn > 20
> and h.tn < 30
>
> my left join
> returns only 34,000
>
> select count(*)
> from h left join p using (r,pos)
> where h.tn > 20
> and h.tn < 30
> and p.r_order=1
>
> since it is a left join I though I should get a number no smaller in the
> left join than the original unjoined query.
You don't. You make the left join, then apply another condition
"p.r_order=1". If you want to demonstrate a problem, you'll need to make
sure the queries are the same.
-- Richard Huxton Archonet Ltd