Left outer join on more than one table

Post Reply
dominik
Posts: 1
Joined: Wed Dec 02, 2009 6:31 pm

Left outer join on more than one table

Post by dominik » Thu Dec 03, 2009 12:26 pm

Hi,
I'm wondering if anybody has had success joining more than one table to the query.

I have this simple join which works fine:

Code: Select all

SELECT t1.id, t2.id, t3.id
FROM {oj Table1 t1 LEFT OUTER JOIN Table2 t2 ON t2.t1_id = t1.id}
but I'm trying to add another table and I've tried several syntaxes, without luck:

This kind of join works well in MySQL, not in KISAM:

Code: Select all

SELECT t1.id, t2.id, t3.id
FROM {oj Table1 t1 LEFT OUTER JOIN Table2 t2 ON t2.t1_id = t1.id
LEFT OUTER JOIN Table3 t3 ON t2.id = t3.t2_id}  


Slightly different:

Code: Select all

SELECT t1.id, t2.id, t3.id
FROM {oj Table1 t1 LEFT OUTER JOIN Table2 t2 ON t2.t1_id = t1.id
}  LEFT OUTER JOIN Table3 t3 ON t2.id = t3.t2_id
My own guess...

Code: Select all

SELECT t1.id, t2.id, t3.id
FROM 
{oj Table1 t1 LEFT OUTER JOIN 
	{oj Table2 t2 LEFT OUTER JOIN Table3 t3 ON t2.id = t3.t2_id}
	ON t2.t1_id = t1.id
}
Taken from Sybase Powerbuilder website:

Code: Select all

SELECT t1.id, t2.id, t3.id
FROM {oj {oj Table1 t1 LEFT OUTER JOIN Table2 t2 ON t2.t1_id = t1.id
}  LEFT OUTER JOIN Table3 t3 ON t2.id = t3.t2_id} 
No luck whatsoever,
Any hint will be highly appreciated

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests