Hi,
I can use some help with the following query please.

Given a couple of tables I want to do a JOIN like operation. Except that one
of the columns might be null.

create table T1 ( id serial, name varchar(20) );
create table T2 ( id serial, name varchar(20) );
create table T1_T2 ( id serial, t1_id integer not null , t2_id integer );

Now I'd like to show a list of records from T1_T2 but reference T1 and T2
for the names instead of IDs. But T1_T2.t2_id might be null

select T1_T2.id, T1.name , T2.name from T1, T2, T1_T2
where T1_T2.t1_id = T1.id and T1_T2.t2_id = T2.id

Basically since t2_id might be null, the condition will fail and the query
will fail

thanks
Medi

Reply via email to