I am trying to execute this SOQL:
productIdsThatExist = [SELECT id FROM Product2 WHERE id IN (SELECT id FROM Cross_sell__c WHERE (Accountforproduct__c =: acc.id) AND (Discussion_status__c!=null) )];
I get this error:
Error: Compile Error: The selected field 'id' in the subquery and the left operand field in the where expression in the outer query 'id' should point to the same object type at line 64 column 30
My data model is:
Accounts > MD > Cross_sell__c < Lookup < Products
Which seems to be exactly the same as in Salesforce's deeper look at SOQL and Relationship Queries.