I have the following pseudo-SQL schema:
table flight
id int primary key
date timestamp
aircraft_id int (foreign key to aircraft.id)
table flight_component
flight_id int (foreign key to flight.id)
component_id int (foreign key to component.id)
duration double
If I convert this to using CoreData, is there an equivalent way to get the total duration for each component with a different query predicate? I think the SQL equivalent will be
select component_id, sum(duration)
from flight_component
join flight on (flight_component.flight_id = flight.id)
where flight.date between ? and ?
group by component_id
Or will I need to make my request and then summarize all the components myself?
source
share