I get this error in output:

Bind variables only allowed in Apex code'

The query is:

   "SELECT O.Id, O.Name, O.OwnerId, U.Name FROM Opportunity as O,User as U WHERE  O.OwnerId = U.Id  "

What's wrong with this query?

  • what would you like to do? Would you like to test if the logged user is the same of the Opportunity?
    – m Peixoto
    Jan 26, 2018 at 12:08
  • @mPeixoto Yes, and return the owner who creates the opportunity
    – OiRc
    Jan 26, 2018 at 12:09

1 Answer 1


you could write the same SOQL in this way:

SELECT ID, Name, OwnerId, Owner.Name
From  Opportunity

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .