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
111111 

select a.ID from PricebookEntry a Product2 b where Product2.ProductCode =:productCode

select a.ID from PricebookEntry a   Product2 b where Product2.ProductCode =:productCode    

error is appeared.

unexpected token: Product2 

 

 

how can i make the SOQL[select a.ID from PricebookEntry a   Product2 b where Product2.ProductCode =:productCode ] to be right?

BoxBox


you can also use the 'salesforce.schema' in the eclipse plugin to create your SOQL by clicking the required feilds and expanding references to produce the following:

Code:
Select p.Product2.ProductCode, p.Product2Id, p.Id From PricebookEntry p

 
So i would just rearange to:

Code:
Select p.Product2Id, p.Id From PricebookEntry p where p.Product2.ProductCode = :YourInput