OUTER JOIN with filter
От | Nicolas Fertig |
---|---|
Тема | OUTER JOIN with filter |
Дата | |
Msg-id | 3e61011d$0$1220$5402220f@news.sunrise.ch обсуждение исходный текст |
Ответы |
Re: OUTER JOIN with filter
Re: OUTER JOIN with filter |
Список | 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 по дате отправления: