OUTER JOIN with filter

Поиск
Список
Период
Сортировка
От Nicolas Fertig
Тема OUTER JOIN with filter
Дата
Msg-id 3e61011d$0$1220$5402220f@news.sunrise.ch
обсуждение исходный текст
Ответы Re: OUTER JOIN with filter  (Bruno Wolff III <bruno@wolff.to>)
Re: OUTER JOIN with filter  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-sql
Hello,

Can anyone help me with the problem bellow ?

I want to have all the row in table "table_main" with the value in the table
"table_slave" (value or null if not exist)

It is possible to have the same result without sub-select in OUTER JOIN
(speed problem on big table) ?

Actualy this is what I make...

CREATE TABLE "table_main" (  "id" int4,  "some_field" varchar(100)
);

CREATE TABLE "table_slave" (  "id" int4,  "name" varchar(100),  "c1" varchar(30)
);

SELECT TM.some_field, TS.name
FROM table_main TM
LEFT OUTER JOIN (SELECT name FROM table_slave WHERE c1 = 'myvalue') TS
USING(id)


the request bellow is not correct:

SELECT TM.some_filed, TS.name
FROM table_main TM
LEFT OUTER JOIN table_slave TS USING(id)
WHERE (TS.c1 = 'myc1' OR TS.c1 IS NULL)

Many thanks,

Nicolas







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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: Beginner needs help
Следующее
От: Denis Zaitsev
Дата:
Сообщение: Re: Are scalar type's in/out functions implicitly STRICT?