Using SOQL, I have two objects, Book__c and Copy__c, Copy is a child of Book. I run a query with a subquery to get copies associated with a book where the copy has a certain status.
The results are what I expect in the Query Editor, but I have trouble putting it into a List in Apex code.
List<Book__c> BookList = [SELECT Id, (SELECT Id, Status__c FROM Copies__r WHERE Status__c = 'Available') FROM Book__c];
This results in a list containing only the Book ID, none of the copy related fields are written to the List. If I change the List to any other data type I get told I can't convert from object type Book to String or whatever I am trying to use.
Can someone tell me the proper way to do this?