You need to sign in to do that
Don't have an account?

Aggregate query bringing back mixed record data
ive got an aggregate query where i want the ID of the Opportunity with the greatest Start Date for a particular Account. However, its not just getting the MAX(Start Date), its also beinging back the MAX ID, which isnt what I want, I want the ID of the Opportunity with the MAX DATE. But SOQL wants me to group or Aggregate the ID, which I dont want.
The only piece of information I really need is the ID of the record with the max date, but thats not happening at the moment
[SELECT max(start_date__c) maxDate, AccountId, MAX(Id) useId FROM Opportunity WHERE StageName = 'Signed' AND AccountId in :setIds GROUP BY AccountId]
The only piece of information I really need is the ID of the record with the max date, but thats not happening at the moment