3
我有以下的僞SQL模式:CoreData相當於總和......一批由
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
如果我將它轉換爲使用CoreData,是有一個相當於方式來獲得與每個組件的總持續時間另一個查詢謂詞?我認爲相當於SQL的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
或者我將不得不使我的查詢,然後總結自己的所有組件?
如何計算核心數據表中特定列的總和? – 2012-05-25 11:59:55