I'm trying to generate a set of Opportunity Ids that have 'Legal' cases. But I'm getting the 'inner select field 'Opportunity__r.Id' cannot have more than one level of relationships. Is there a better way of doing this without first pulling a list of sObjects then iterating using a for loop to get the Ids? Thank for helping out!
Set<Id> oppIds = new Map<Id, Opportunity>([SELECT Id FROM Opportunity WHERE Id IN (SELECT Opportunity__r.Id FROM Case WHERE RecordType.Name = 'Legal')]);