在我的一个用例中,我有两个表,即flow和conf。流表包含所有航班数据的列表。它有列creationdate,datafilename,aircraftid。 conf表包含配置信息。它有列configdate,aircraftid,configurationame。为一种飞机类型创建了多个配置版本。因此,当我们处理数据文件名时,我们需要从流表中识别aircraftid,并从创建数据文件名之前创建的conf表中获取配置。所以,我试过这个,
<div>
<div class="lb-main-content">
<audio id="audioPlayer"></audio>
<div class="content-wrapper student-shell" style="margin-left:0px">
<div class="lberror" style="display: none" id="errorContainer">
<i class="icon-close alert"></i>
</div>
<div class="container-fluid page-host"
data-bind="router: { transition:'entrance' }"></div>
</div>
</div>
<div class="footer-container"></div>
</div>
这将获取为飞机创建的所有配置,这是显而易见的,因为没有条件可以检查 conf.config_date&lt; flow.f_file_creation_date 。我试图将这种情况包括在内,
define(function(require) {
var router = require('plugins/router');
var ko = require('knockout');
var Datahandler = require('lbdatahandler');
var datahandler = new Datahandler();
var CookieHandler = require('lbcookiehandler');
var cookiehandler = new CookieHandler();
// var dialog = require('plugins/dialog');
// dialog.MessageBox.setDefaults({ "class": "modal-window" });
return {
router : router,
activate : function() {
router
.map(
[
{
route : 'student/activity-sociolearner/:courseid/:lessonid/:activityid(/:submissionid)',
title : 'Sociolearner Activity',
moduleId : 'student/activity-sociolearner',
cssClass : 'student-rec-page',
nav : false,
}, {
route : '',
title : 'My Courses',
cssClass : 'my-coursesMenuItem',
moduleId : 'student/my-courses',
nav : this.isStudent(),
}, ])
.buildNavigationModel()
//.mapUnknownRoutes('#', 'student/my-courses');
.mapUnknownRoutes('notfound/notfound', 'notfound');
//.mapUnknownRoutes('#');
return router.activate();
},
attached : function(view) {
},
};
});
此时失败并显示错误
define(function(require) {
var Backend = require('./backend');
var ko = require('knockout');
var router = require('plugins/router');
var app = require('durandal/app');
var StorageHandler = require('lbstoragehandler');
var storageHandler = new StorageHandler();
var Datahandler = require('lbdatahandler');
var that = this;
var service = new Backend();
var datahandler = new Datahandler();
that.helpCourse = false;
// var HELP_COURSE = 'helpcourse';
return {
activate : function(courseid) {
},
};
});
有人可以在我出错的地方给我一两个提示以及如何解决这个问题吗?
答案 0 :(得分:1)
select f.f_file_creation_date
,f.f_file_archived_relative_path
,f.f_file_archived_name
,f.k_aircraft
,c.config_date
,c.aircraft_id
,c.filefilter
from t_flow as f
join (select config_date
,aircraft_id
,filefilter
,lead (config_date,1,date '3000-01-01') over
(
partition by aircraft_id
order by config_date
) as next_config_date
from t_conf
) c
on c.aircraft_id =
f.k_aircraft
where f.f_file_creation_date >= c.config_date
and f.f_file_creation_date < c.next_config_date
发布问题
当您发布与数据相关的问题时 -
<强> SQL 强>
t1.X = t2.X and t1.Y = t2.Y
)。这就是你收到错误的原因
如果您正在进行内连接(而不是外连接),那么您可以将非等值连接条件移动到WHERE子句。答案 1 :(得分:0)
我无法重现您的错误。我想你的查询是有效的。 你用什么版本的Hive?我用hive 2.1.1测试了这个查询。
DROP TABLE IF EXISTS t_flow;
CREATE TABLE IF NOT EXISTS t_flow (
f_file_creation_date DATE
, f_file_archived_relative_path STRING
, f_file_archived_name STRING
, k_aircraft STRING
);
-- Conf table contains configuration information.
-- It has columns configdate, aircraftid, configurationame
DROP TABLE IF EXISTS t_conf;
CREATE TABLE IF NOT EXISTS t_conf (
config_date DATE
, aircraft_id STRING
, filefilter STRING
);
SELECT
x.f_file_creation_date,
x.f_file_archived_relative_path,
x.f_file_archived_name,
x.k_aircraft,
y.config_date,
y.aircraft_id,
y.filefilter
FROM
(SELECT
f_file_creation_date,
f_file_archived_relative_path,
f_file_archived_name,
k_aircraft
FROM t_flow f) x
JOIN
(SELECT
c.config_date,
c.aircraft_id,
c.filefilter
FROM t_conf c) y on y.aircraft_id = x.k_aircraft where y.config_date < x.f_file_creation_date;