+ Start a Discussion
nabil711nabil711 

SOQL: query for lookup relationship

Hi

 

in QuoteLineItem, I have a field Produit

name : Product2 & Type : lookup(Produit)

 

I need a SOQL query to get information (Family & Name) from Object Product2  

 

Select Product2.Name From QuoteLineItem

 

doesn't work

 

I tried a lot of queries same problems

 

Thanks

 

Best Answer chosen by Admin (Salesforce Developers) 
kamlesh_chauhankamlesh_chauhan

Try below query.

 

"Select ID,Pricebookentry.Product2.Name,Pricebookentry.Product2.Family from QuoteLineItem"

 

 

Regards,

Kamlesh Chauhan

LogicRain Technologies

All Answers

Rajesh SriramuluRajesh Sriramulu

Hi,

 

 

See this,

 

here AZ belongs to analyze object and having one field doctor name  as look up to contact and selecting mailing address from contact.

 AZ =[select id,name,Doctor_Name__r.MailingStreet from analyze];.

 

Hope this will helps u.

 

Regards,

Rajesh.

 

 

kamlesh_chauhankamlesh_chauhan

Try below query.

 

"Select ID,Pricebookentry.Product2.Name,Pricebookentry.Product2.Family from QuoteLineItem"

 

 

Regards,

Kamlesh Chauhan

LogicRain Technologies

This was selected as the best answer
nabil711nabil711

Finally it works Thanks a lot :)