MySQL Forums
Forum List  »  Newbie

Re: IN Clause Error
Posted by: Ramalingam Chelliah
Date: August 31, 2004 04:23AM

Hi,
You can give a list in IN clause but not a *subquery* in 4.0.20 .

SELECT * FROM vcGroup WHERE ObjectId NOT IN (1,3,14);
is valid .

Try to join tables instead and rewrite your query ...

SELECT *
FROM
vcGroup
LEFT OUTER JOIN
vcFolderSecurity
ON vcGroup.ObjectId=vcFolderSecurity.GroupId
WHERE
vcFolderSecurity.ObjectId=293
AND
vcFolderSecurity.GroupId IS NULL;

LEFT OUTER JOIN will return NULL for those records in vcFolderSecurity which have GroupId=vcGroup.ObjectId

The last condition is to get the expected result ...Since we are joining
tables in contradictory fashion...

Regards,
Ram.




We Learn the Most When we have to Invent

Options: ReplyQuote


Subject
Written By
Posted
August 30, 2004 01:16PM
Re: IN Clause Error
August 31, 2004 04:23AM
August 31, 2004 05:21AM
September 13, 2004 11:08PM
September 14, 2004 12:12AM


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.