function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
GoodGrooveGoodGroove 

SOQL Query Condition for nested relationship

Hi everybody,

 

maybe some one of you guys can help with this problem. I try to query all records from the WorkflowStep__c object where User = system.getUserInfo.getUserID() or the current user has an entry in the WorkflowResourceMember__c object

 

 

 

 

I tried the following query:

 

 

 

wsteplist = [

 

select

id,

Name

 

from WorkflowStep__c

 

where ShowInList__c = 'Open' AND

(User__c =: system.UserInfo.getUserId() OR

Ressource__c IN (select WorkflowResource__c from WorkflowResourceMember__c where Memeber__c =: system.UserInfo.getUserId() ) )

];

 

 but returned error: 

 

Error: Compile Error: Semi join sub-selects are only allowed at the top level WHERE expressions and not in nested WHERE expressions. at line 7 column 21 

 

I really appreciate your help

 

Cheers

Sebastian

 

 

Message Edited by GoodGroove on 07-03-2009 01:03 AM
Best Answer chosen by Admin (Salesforce Developers) 
sfdccoder1sfdccoder1

 

Hi Sebastian,

 

your sub query is simply not possible in SOQL (though it is in SQL).

I suppose you have to break it to two sub queries and usesome apex processing in between.

 

David. 

 

Message Edited by sfdccoder1 on 07-05-2009 12:08 PM

All Answers

sfdccoder1sfdccoder1

 

Hi Sebastian,

 

your sub query is simply not possible in SOQL (though it is in SQL).

I suppose you have to break it to two sub queries and usesome apex processing in between.

 

David. 

 

Message Edited by sfdccoder1 on 07-05-2009 12:08 PM
This was selected as the best answer
GoodGrooveGoodGroove

Thanks David.

 

Saravanan @CreationSaravanan @Creation
Hi,

Could you please send me the reson behid this. If you send me some referal link that will be great.

Thanks!