2014-02-10 2 views
1

에 의해, 필터 및 조인 순서 :YDN-DB 내가 이벤트와 events_date 객체를 가지고 있고이 같은 쿼리를 결합하는 방법을 알고 싶어

select * 
    from events, events_dates 
    where events.objectid=event_dates.eventID 
    order by event_dates.startDate asc 

여기 내 스키마입니다. @Risingson에 의해 연결로

var events_schema = { 
name:   'events', 
keyPath:  'objectid', 
type:   'TEXT', 
autoIncrement: false, 
indexes: [ 
{ 
    keyPath: 'eventName' 
    }, { 
    keyPath: 'contactPerson' 
}, { 
    keyPath: 'contactPersonEmail' 
}, { 
    keyPath: 'contactPersonCell' 
}, { 
    keyPath: 'eventURL' 
}, { 
    keyPath: 'city' 
}, { 
    keyPath: 'address' 
}, { 
    keyPath: 'parishStateProvince' 
}, { 
    keyPath: 'country' 
}, { 
    keyPath: 'isFeatured' 
}, { 
    keyPath: 'shortDescription' 
}, { 
    keyPath: 'salesCutOffHour' 
}, { 
    keyPath: 'venu' 
}, { 
    keyPath: 'longDescription' 
}, { 
    keyPath: 'createdAt' 
} 

] 
}; 


var events_dates_schema = { 
name:   'event_dates', 
keyPath:  'objectid', 
type:   'TEXT', 
autoIncrement: false, 
indexes: [ 
{ 
    keyPath: 'eventID' 
}, { 
    keyPath: 'deliveryMethodMobile' 
}, { 
    keyPath: 'deliveryMethodWillCall' 
}, { 
    keyPath: 'endDate' 
}, { 
    keyPath: 'endAmPm' 
}, { 
    keyPath: 'maxAvailableTickets' 
}, { 
    keyPath: 'salesCutOffHour' 
}, { 
    keyPath: 'startAmPm' 
}, { 
    keyPath: 'startDate' 
} 

] 
}; 
+0

http://stackoverflow.com/questions/21515180/most-efficient-way-to-query-ydn-db-in-a-joining-way – Risingson

답변

0

내가 대답을 복사합니다 : 당신은 그러나이 YDN-DB API를 사용하여 매우 어려운 가입하고,이 얼마나 간단하게 볼 수 있도록 나는이 포함되어있다.

현재 복합 인덱스가 [objectid, startDate], [eventID, startDate]ydn.db.algo.ZigzagMerge을 사용해야하며, 사용하기가 매우 어렵습니다. 다행히도 (또는 절대로) 쿼리 모듈을 끝낼 것입니다.이 경우 모든 등가 결합에 대해 여러 개의 where 절을 작성하면됩니다.