我有事件和events_date对象,想知道如何进行这样的连接查询:
select *
from events, events_dates
where events.objectid=event_dates.eventID
order by event_dates.startDate asc
这是我的架构。我已经包含了这个,所以你可以看到它是多么简单,但使用ydn-db api进行连接非常困难:
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 :(得分:0)
我将复制由@Risingson链接的答案。
目前,您必须使用ydn.db.algo.ZigzagMerge
复合索引[objectid, startDate]
,[eventID, startDate]
,这非常难以使用。希望(或永远)我将完成查询模块,在这种情况下,您只需为任何相等的连接编写多个where子句。