On Wed, 29 Nov 2006, Ehab Galal wrote: > I have three tables t1(a, b, c, d), t2(a, b, c, k), and t3(c, e). I need to > outer join them as shown below, but only have all tuples from t1 as output. > But the following syntax does not allow me to do so. > > SELECT t1.* > FROM (t1 outer join t2 on (t1.a=t2.a and t1.b=t2.b)) t outer join t3 on > (t1.c=t3.c);
I think you don't want to alias the output of the t1/t2 join to t if you're planning to continue referring to t1 in the rest of the query since I think the alias is going to hide the original t1 name. I'm not sure which outer join you were trying to use, but assuming left for now, I think something like SELECT t1.* FROM t1 left outer join t2 on (t1.a=t2.a and t1.b=t2.b ) left outer join t3 on (t1.c=t3.c); might work for you. ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq