我有以下伪SQL架构:
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
Run Code Online (Sandbox Code Playgroud)
如果我将其转换为使用CoreData,是否有一种等效方法可以使用另一个查询谓词来获取每个组件的总持续时间?我认为SQL等价物
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
Run Code Online (Sandbox Code Playgroud)
或者我将不得不进行查询,然后自己总结所有组件?
| 归档时间: |
|
| 查看次数: |
4460 次 |
| 最近记录: |