MySQL Forums
Forum List  »  Microsoft SQL Server

Re: SQL Syntax headache
Posted by: Jay Pipes
Date: December 05, 2005 08:40PM

Make sure you are using a version of MySQL that supports subqueries (4.1 and up).

or use the standard, efficient INNER JOIN:

SELECT c1.ID, c1.DateEntered, c1.name, c2.Company as myCompany
FROM contacts c1
INNER JOIN contacts c2
ON c1.DiveShopRef = c2.ID
ORDER by c1.ID ASC;

For best performance, make sure you have an index on contacts.DiveShopRef

Jay Pipes
Community Relations Manager, North America, MySQL Inc.

Got Cluster? http://www.mysql.com/cluster
Personal: http://jpipes.com

Options: ReplyQuote


Subject
Written By
Posted
December 04, 2005 01:31PM
Re: SQL Syntax headache
December 05, 2005 08:40PM


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.