I need to pull out a query that fetches:
From My Team object and Package object. Package is a child of Teams
From teams I need to pull how many packages is currently in teams and how much each packages weigh in total:
SELECT SUM(Weight__c) TotalWeight, COUNT(id) numOfPackages, Team__r.Phone, Team__r.Name,Team__r.id FROM Package__c GROUP BY Team__r.Phone, Team__r.Name,Team__r.Id
But I also need to know the last package that was added to the team:
SELECT Id, (SELECT Id, Name, CreatedDate, weight__c FROM Package__r ORDER BY CreatedDate DESC LIMIT 1) FROM Team__c
How, if possible, could I combine these two queries?