Trying to update an OpportunityLineItem, but need to be able to look for that particular product in the opportunity.
Problem:
SOQL is using the List Price from the product but from a different opportunity
Error:
in (SELECT OpportunityId FROM OpportunityLineItem)LIMIT 1 ^ ERROR at Row:4:Column:103 The inner and outer selects should not be on the same object type
I understand what the error is, but can't figure out a solution to get what I need. Any ideas?
SOQL
OpportunityLineItem optLIProductB = [SELECT OpportunityId, Opportunity.Pricebook2Id, Name, ProductCode , PricebookEntryId, Quantity, UnitPrice
FROM OpportunityLineItem
WHERE ProductCode = '1b0000'
AND OpportunityId in (SELECT OpportunityId FROM OpportunityLineItem)LIMIT 1];