You need to sign in to do that
Don't have an account?

The left operand 'account.ownerid' cannot have more than one level of relationships
Trying to alter some SOQL in my environment to filter on Account Owner rather than Contact Owner. Now I'm used to SQL and find SOQL maddening as I am not fully to grips with the syntax to do things I would find matter of fact in SQL. Here is what I have:
If anyone can point out the logic to me so I can learn from this, that would be great!
allcontacts=[select id, firstname, lastname, speciality__c, account.name, pcm_contact_type__c, account.ownerid, account.shippingpostalcode, account.target_account__c from contact where Id not in (select contact__c from PCM_Activity_Attendee__c where PCM_Activity__c=:stdCtrl.getId()) and firstname like :'%' + search.firstname + '%' and lastname like :'%' + search.lastname + '%' and (pcm_contact_type__c like :search.pcm_contact_type__c+ '%' ) and account.name like :'%' + search.department + '%' and account.shippingpostalcode like :'%' + search.MailingPostalCode + '%' and account.ownerid not in (select account.ownerid from account where account.ownerid=:search.profession__c) and Account.RecordTypeId = '01230000000Y77V' order by account.name asc, lastname, firstname limit 50];It is the bolded line that is the issue.
If anyone can point out the logic to me so I can learn from this, that would be great!
Try something like below :-
If this helps,please mark it as best answer to help others :)
All Answers
The reason why I did this is because SOQL doesn't allow you to make more than one level deep of relationships in where filters.
If this helps,please mark it as best answer to help others :)
Try something like below :-
If this helps,please mark it as best answer to help others :)
It sees that the name on my VF page is having no impact on the search whatsoever, it returns records for all users regardless.
I am sure something not going googd with the serach keyword.
Hope this helps !!