我使用此代码来迭代自定义对象:
interface TableItemBody {
[fieldId: string]: string
}
interface TableItem {
[tabId: string]: TableItemBody | TableItemBody[]
}
const iterate = (entry: TableItem) => {
for (const tabId of Object.keys(entry)) {
if (Array.isArray(entry[tabId])) {
for (const idx of entry[tabId]) {
for (const fieldId of Object.keys(entry[tabId][idx])) {
console.log(fieldId)
}
}
} else {
for (const fieldId of Object.keys(entry[tabId])) {
console.log(fieldId)
}
}
}
}
const tableItem: TableItem = {
tab1: {
field1: 'fieldValue'
},
tab2: [{
field2: 'fieldValue'
}]
}
iterate(tableItem)
Run Code Online (Sandbox Code Playgroud)
但是,我收到两个错误。第一个是 …
我有一张基本上看起来像这样的表:
Date | Criteria
12-04-2016 123
12-05-2016 1234
...
Run Code Online (Sandbox Code Playgroud)
现在我想在给定范围内的"Criteria"列中选择具有值的行,但我想保留提取的行.提取的行应该为"Criteria"列获取值"null".例如,如果我想选择'Criteria = 123'的行,我的结果应如下所示:
Date | Criteria
12-04-2016 123
12-05-2016 null
Run Code Online (Sandbox Code Playgroud)
目前我正在使用此查询来获取结果:
SELECT b.date, a.criteria
FROM (SELECT id, date, criteria FROM ABC WHERE criteria > 100 and criteria < 200) a
FULL OUTER JOIN ABC b ON a.id = b.id ORDER BY a.criteria
Run Code Online (Sandbox Code Playgroud)
有人告诉我,全外连接表现非常糟糕.另外,我的表有400000条记录,并且经常使用查询.所以任何人都有想加快我的查询?顺便说一下,我使用的是Oracle11g数据库.