I have a Product Purchase as a parent object of a child object namely Payment. Now, when I run the query below, I am also getting Product Purchase objects which do not have any Payment(s) attached to them. How would I filter this using a COUNT().
$query = "SELECT Id, CreatedDate,
(SELECT Id, PayPal_Transaction_Id__c, CreatedDate
FROM Payments__r
WHERE PayPal_Transaction_Id__c != null),
Installments__c, Paid__c
FROM Product_Purchase__c
WHERE Installments__c > 1
AND Paid__c = false";