Re: left joins

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: left joins
Дата
Msg-id 42CBB2AF.2010601@archonet.com
обсуждение исходный текст
Ответ на left joins  ("Grant Morgan" <grant@ryuuguu.com>)
Список pgsql-sql
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


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Grant Morgan"
Дата:
Сообщение: left joins
Следующее
От: "Nick Stone"
Дата:
Сообщение: Re: left joins