QlikView 中的非标准连接?

发布于 2024-08-21 09:58:47 字数 351 浏览 4 评论 0原文

最近我们一直在办公室测试 QlikView。第一印象很好:它有一个有吸引力的界面并且执行速度非常快。我们希望将其用作客户的数据库前端。我们还试图确定它是否可以接管我们的部分关系数据库结构。然而,我们怀疑它的数据库功能是否足够先进,不仅仅是一个有吸引力的前端。

具体来说,我们遇到了以下问题。只需在表之间设置相同的字段名称即可在 QlikView 中完成与普通 JOIN(等值连接)操作的等效操作 - 然后这些字段将被链接。然而,我们传统的 SQL JOIN 操作之一使用“BETWEEN”查询来查找日期是否在特定范围内,并在该范围内连接数据。

是否可以在 QlikView 中的表之间指定这种“非等值连接”关系?或者这是所谓的“关联数据库”结构的固有限制?

Lately we have been testing QlikView in the office. The first impression is good: it has an attractive interface and performs very fast. We want to use it as a database frontend for our customers. We are also trying to determine whether it can take over parts of our relational database structure. However, we are in doubt whether its database functions are advanced enough to be more than an attractive frontend.

Specifically, we run into the following problem. The equivalent of normal JOIN (equijoin) operations can be done in QlikView simply by setting equal field names across tables - those fields will then be linked. However, one of our traditional SQL JOIN operations uses a "BETWEEN" query to find out whether a date is in a certain range and join the data on that.

Is it possible to specify such a "non-equijoin" relationship between tables in QlikView? Or is this an inherent limitation to the so-called "associative database" structure?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夜未央樱花落 2024-08-28 09:58:47

马库斯的回答是正确的。实现此目的的方法是使用 IntervalMatch。您可以按原样保留两个表,并使用 IntervalMatch 在它们之间添加“之间”关系。加载脚本运行后您无法添加关系。

首先,您必须加载具有日期范围的表(省略 SQL 查询)。比方说:

Ranges:
LOAD
    rangeID,
    validfrom, // date
    validto,   // date
    commonkey, // common key for the two tables
    price;     // the data that's needed as a result of the linking

其次,您加载另一个带有日期的表

Data:
LOAD
    column1,
    column2,
    date,
    commonkey;

接下来您将必须使用 IntervalMatch。这是一种方法:

Left Join (Data)
IntervalMatch(date, commonkey)
LOAD
    validfrom,
    validto,
    commonkey
Resident Ranges;

现在您拥有两个表之间的链接。您可以通过添加以下内容来删除生成的合成键:

Left Join (Data)
LOAD
    validfrom,
    validto,
    commonkey,
    rangeID
Resident Ranges;

DROP Fields validfrom, validto FROM Data;

现在,表是使用 rangeID 键链接的。如果表没有一些共同的键,例如类别 ID 或其他内容(即只需匹配日期),您可以忽略上面示例中的 commonkey 。我只是想将其包含在示例中,因为我自己的案例中需要它,希望它能帮助遇到类似问题的人。

您可以在标有“IntervalMatch(扩展)”的 Qlikview 帮助中找到此信息。 Qlikview Cookbook (fillrowsintervalmatch.qvw) 也帮助我解决了这个问题。

Marcus' answer is correct. The way to do this is to use IntervalMatch. You can have the two tables as they are and add a "between" relationship between, using IntervalMatch. You can't add relationships after the load script has run.

First you'll have to load the table that has the date range (sql queries omitted). Let's say:

Ranges:
LOAD
    rangeID,
    validfrom, // date
    validto,   // date
    commonkey, // common key for the two tables
    price;     // the data that's needed as a result of the linking

Second, you load another table with the date

Data:
LOAD
    column1,
    column2,
    date,
    commonkey;

Next you will have to use the IntervalMatch. This is one way to do it:

Left Join (Data)
IntervalMatch(date, commonkey)
LOAD
    validfrom,
    validto,
    commonkey
Resident Ranges;

Now you have the link between the two tables. You can delete the resulting synthetic key by adding this:

Left Join (Data)
LOAD
    validfrom,
    validto,
    commonkey,
    rangeID
Resident Ranges;

DROP Fields validfrom, validto FROM Data;

Now the tables are linked by using the rangeID key. If the tables don't have some key in common, like a category id or something, (ie. just the dates need to be matched), you can just ignore the commonkey in the example above. I just wanted to include it in the example because I needed it in my own case and hopefully it will help someone with a similar issue.

You can find this in the Qlikview help labeled "IntervalMatch (extended)". The Qlikview cookbook (fillrowsintervalmatch.qvw) also helped me with this issue.

能怎样 2024-08-28 09:58:47

当然可以 - 我想你想要的是 IntervalMatch 函数。

Sure can - I think what you want it the IntervalMatch function.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文