I receive unknown parsing error while executing following soql query in dev console.

SELECT Name,OwnerId from account where ID in (Select AccountId from User WHERE Id = 00536000005bkdTAAQ)

I want to look at accounts associated with this user.


You need to wrap the Id value in single quotes ('):

WHERE Id = '00536000005bkdTAAQ'
//         ^   missing these  ^ 
  • Oh thank you. . I have tried above correction and result comes back as 0. While that user is owner of atleast 2 accounts that I know of – Aman Jul 12 '17 at 20:04
  • If you want to filter on this user owning the records you would do WHERE OwnerId = '005...'. – Adrian Larson Jul 12 '17 at 20:06
  • SELECT Name,OwnerId from contact where OwnerId ='00536000005bkdTAAQ'; I tried that and I am getting parsing error agian' – Aman Jul 12 '17 at 20:08
  • 1
    Why did you change the query object from Account to Contact? – Adrian Larson Jul 12 '17 at 20:09
  • 1
    Are you including a semicolon in the query itself? That is not valid syntax. Please update your question post with the exact query you are still struggling with. – Adrian Larson Jul 12 '17 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.