I'm doing this query
Select id, name, (select quantity, PriceBookEntry.Name from OpportunityLineItems where quantity != NULL) from Opportunity where StageName = 'Closed Won'
And it'll return a bunch of Opportunities
, but for some of them, OpportunityLineItems
will be null.
How can I only return the Opportunities
that have OpportunityLineItems
?
Doing and OpportunityLineItems != NULL
makes the query crash with
Invalid Field [object Object]: where StageName = 'Closed Won' and OpportunityLineItems != NULL ^ ERROR at Row:1:Column:158 No such column 'OpportunityLineItems' on entity 'Opportunity'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.