+ Start a Discussion
niki s 7niki s 7 

Soql query on opportunity to retrieve pricebookEntry and pricebook2

Select I'd,( select I'd from pricebookEntries),(select id from opportunities where I'd='111') from pricebook2
I want to write this query on opportunity object.
I Just want to retrieve pricebookEntry and pricebook2 where opp id is 11
 
Nayana KNayana K
Please give this a try:
Select Id,( select Id from pricebookEntries) from pricebook2 WHERE Id IN (SELECT PriceBook2Id FROM Opportunity WHERE Id = '111')
niki s 7niki s 7
Thanks