You need to alias some field to Id
in order for the Map<Id, SObject>(List<SObject>)
constructor to work.
SELECT
OpportunityLineItemId Id,
MIN(ScheduleDate) Starts
FROM OpportunityLineItemSchedule
WHERE ...
GROUP BY OpportunityLineItemId
As your query is currently written, a given AggregateResult
will only allow you to get three "fields":
expr0
OpportujnityLineItemId
Starts