MySQL Forums
Forum List  »  New in 4.1: Subqueries

Re: Subqueries using the same source table
Posted by: Brian Caruso
Date: February 11, 2005 10:38AM

You will have to rewrite statements to use joins or to not use subqueries with the same table:

SELECT dataID FROM data WHERE data.Name NOT LIKE '???'
AND dataID IN
(SELECT dataID FROM data WHERE data.Class LIKE 'arm' OR data.Class LIKE 'hand' OR data.Class LIKE 'fist' )

becomes:

SELECT dataID FROM data WHERE data.Name NOT LIKE '???'
AND (data.Class LIKE 'arm' OR data.Class LIKE 'hand' OR data.Class LIKE 'fist')

Options: ReplyQuote


Subject
Views
Written By
Posted
8629
February 10, 2005 02:36PM
Re: Subqueries using the same source table
4294
February 11, 2005 10:38AM


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.