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

SOQL Query on Opportunity !=
Hi,
I'd like to execute something like this :
SELECT Id
FROM Opportunity
WHERE OwnerId != Opportunity.Account.OwnerId
Unfortunately, I got this error message.
MALFORMED_QUERY:
FROM Opportunity
^
ERROR at Row:3:Column:17
Bind variables only allowed in Apex code
Is there a work around ?
I'd like to execute something like this :
SELECT Id
FROM Opportunity
WHERE OwnerId != Opportunity.Account.OwnerId
Unfortunately, I got this error message.
MALFORMED_QUERY:
FROM Opportunity
^
ERROR at Row:3:Column:17
Bind variables only allowed in Apex code
Is there a work around ?
May I suggest you please check with below which might help you Also seems nothing wrong with the above code is well.
Please let us know if this helps.
Best Regards,
Nagendra.
To achieve above requirement you have to create a formula field in account using bellow formula
Formula
IF( OwnerId = Account.OwnerId , 'true', 'false')
return type should be text
and then write a query like bellow
accountowner__c is forumla field i have created in developer organisation if you have any doubt please let me know
Thank you
for clarification i am asking these question
you want to retrieve the opportunity records when the owner of oppotunity and acccount is same .am i right?
Thank you
When they are different.
sorry i have given code for owners are same .
Thank you