我有事件和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'
}
]
};发布于 2014-02-16 12:27:31
我会复制@Risingson链接的答案。
目前,您必须将ydn.db.algo.ZigzagMerge与复合索引[objectid, startDate]、[eventID, startDate]一起使用,这很难使用。希望(或者永远不会)我会完成查询模块,在这种情况下,您只需为任何相等的连接编写多个where子句。
https://stackoverflow.com/questions/21673430
复制相似问题