top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How can I query parent to child with two child values and no other child values?

+2 votes
720 views

I have one parent "quote__c" and child object "Quote_line_item__c" .I want get the parent id with query some thing like this

select id,(select name from quote_line_item__c where name='123' and name='456') from quote__c
posted Mar 13, 2016 by Shivam Kumar Pandey

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Do you have a rollup summary field that holds count of line items? If you do - this might be one way to do it:

SELECT Id FROM Quote__c WHERE Id IN (SELECT Quote__c FROM Quote_Line_Item__c WHERE Name = '123') AND Id IN (SELECT Quote__c FROM Quote_Line_Item__c WHERE Name = '456') AND Lines_count__c = 2

answer Mar 14, 2016 by Manikandan J
Similar Questions
+2 votes

I am a beginner. Can someone explain how to write a SOQL query to get child custom object when parent information is given and vice versa?
//student__c - child object, college__c-parent object, Related through Master detail

...