Re: Double Bendback Query
Posted by:
Jay Pipes
Date: July 11, 2005 03:34AM
I have to say I'm a bit confused as to how these tables relate... but that said, the following two statements:
SELECT alias_id FROM t2 WHERE t1_id = '230'
SELECT firstname, lastname FROM t1 LEFT JOIN t2 ON t1.id = t2.t1_id WHERE alias_id = ~result from previous query~
Can be reduced to:
SELECT firstname, lastname
FROM t1
CROSS OIN t2 as t3
LEFT JOIN t2
ON t1.id = t2.t1_id
AND t2.alias_id = t3.alias_id
WHERE t3.t1_id = '230';
Jay Pipes
Community Relations Manager, North America, MySQL Inc.
Got Cluster?
http://www.mysql.com/cluster
Personal:
http://jpipes.com
Subject
Written By
Posted
Re: Double Bendback Query
July 11, 2005 03:34AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.