Query question

Поиск
Список
Период
Сортировка
От Medi Montaseri
Тема Query question
Дата
Msg-id 8078a1730805221428p6c261893r6fc95ca920299370@mail.gmail.com
обсуждение исходный текст
Ответы Re: Query question
Список pgsql-sql
Hi,<br />I can use some help with the following query please.<br /><br />Given a couple of tables I want to do a JOIN
likeoperation. Except that one of the columns might be null.<br /><br />create table T1 ( id serial, name varchar(20)
);<br/> create table T2 ( id serial, name varchar(20) );<br />create table T1_T2 ( id serial, t1_id integer not null ,
t2_idinteger ); <br /><br />Now I'd like to show a list of records from T1_T2 but reference T1 and T2 for the names
insteadof IDs. But T1_T2.t2_id might be null<br /><br />select T1_T2.id, T1.name , T2.name from T1, T2, T1_T2<br
/>whereT1_T2.t1_id = T1.id and T1_T2.t2_id = T2.id<br /><br />Basically since t2_id might be null, the condition will
failand the query will fail<br /><br />thanks<br />Medi<br /> 

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

Предыдущее
От: "Sebastian Rychter"
Дата:
Сообщение: Extremely Low performance with ODBC
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Query question