7

I am looking for the where in syntax for raw soql.

I try:

SELECT ID, OWNDERID FROM Opportunity where OwnerID in {'005G0000002eMbxIAE'};

and

SELECT ID, OWNDERID FROM Opportunity where OwnerID in '005G0000002eMbxIAE';

Neither work. Any tips?

1
  • 1
    Please tell us the OWNDERID is just a typo made here and not in the original queries ;)
    – eyescream
    Apr 18 '13 at 16:18
11

With just one id, you should just do:

SELECT Id, OwnerId FROM Opportunity where OwnerID = '005G0000002eMbxIAE';

But if you are doing multiple ids, you can do in with:

SELECT Id, OwnerId FROM Opportunity where OwnerID in ('005G0000002eMbxIAE', '005G0000002eMbxIAE');

Or you can pass a list:

List<Id> ownerIds = ...
SELECT Id, OwnerId FROM Opportunity where OwnerID in :ownerIds;

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.