function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Andrew Morales 1Andrew Morales 1 

SOQL Query Question - Select Specific ID's

Hello.
I would like to write a SOQL query in Data Loader that would include a list of 100 specific Contact record ID's to export (only) those records.
This is as close as I came but it is not returning the expected results.

SELECT Id,
FROM Contact
WHERE ID IN ('a4fa0000000KzbV','a4fa0000000KzbW',...........)

Any help would be greatly appreciated.
 
Andrew Morales 1Andrew Morales 1
And a follow up question, could this query be used to pull based on specific email addresses instead of ID's?
Chris  ByromChris Byrom
1. The Ids you are including are not Contact IDs. Contacts always start with '003', that is the table prefix for contact. 'a4f' looks like a custom object. The syntax is correct for selecting multiple things based on a list however. If these Ids are from another field on the contact, you should reference that field in the where clause, instead of the ID field.

2. Yes, you could include a list of email addresses to get all contacts that have one of the email addresses. One thing to note is that multiple contacts can have the same email adress.
sailee handesailee hande
hi Andrew,

This
SELECT Id,
FROM Contact
WHERE ID IN ('a4fa0000000KzbV','a4fa0000000KzbW',...........) way will help you to get specific 100 records but this might increase your work as you have to put all 100 contact ids in condition instead of that you can use some other field that matched only these 100 contacts.