+ Start a Discussion




I have Opportunity object and contact object. I have to pull the data using salesforce dataloader from contact obj. for this obj i have opportunity as the child object. Can i write a query by joining these two objects?




select contact.id,opportunity.id

from contact,opportunity

where opportunity.fieldname='text'


Is it possible in salesforce dataloder export?


or we can write a query only for one object at a time?



Jerry ClifftJerry Clifft

I beleive dataloader will only do a single object at time.

Suresh RaghuramSuresh Raghuram


write the query like this 


select Id, Name , <Opportunity Lookup filedname__r.Name> from contact


Note: dataloader did not support subquerys.

IF this answers your question make this as solution and give kudos please


write the query like this



Select Id, Name from contact where id in(select contactId from opportunity wher opportunity .name = you criteria)

Thats great !!
It works.

But in my situation, am pulling the data from the parent object. so i dont have specific field "Amount" of child in parent obj. and i want this field in my result table.

the only thing i see in contact object is just the opportunity name in the related list. but no look up nothing.

How can i access opportunity field from contact object in this case.


In addition to that,
i have different record types on contact obj.
How to access one specific record type?

Is it with record type id?


If so, in following link what is the record type id?








In this query you can add where clause like this


Select Id, Name from contact where id in(select contactId from opportunity wher opportunity .name = you criteria) where recordtypeId = 'your recordtype Id


retURL=%2F001%2Fo&RecordType=012d0000000tCpn&ent=Account  in this link the bold part is recordtypeId

Does dataloader supports nested query?

No in dataloader Nested Queries are not supported.


If this post solves your problem kindly mark it as solution. if this post is helpful please throw Kudos.


Suresh RaghuramSuresh Raghuram

No Vinny you can not do sub querys in data loader.


when u did not have a lookup to that particular object and you have a related list link you can do the query as follows.


select Id, <objectName__r.FieldName> from the Contact.


to get the record type ids, you can do query to the RecordType  Object.


SELECT id,Name FROM RecordType where Name ='Non Usa'


If you have some thing to do with the record type and the data that is related withabove said first query. you should use some data cleansing technicques with Excel like VLOOKUP and sorting Technicques.


If thia answers your question make this as a solution. and give kudos plz