QlikView 中的非标准连接?
最近我们一直在办公室测试 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
马库斯的回答是正确的。实现此目的的方法是使用 IntervalMatch。您可以按原样保留两个表,并使用 IntervalMatch 在它们之间添加“之间”关系。加载脚本运行后您无法添加关系。
首先,您必须加载具有日期范围的表(省略 SQL 查询)。比方说:
其次,您加载另一个带有日期的表
接下来您将必须使用 IntervalMatch。这是一种方法:
现在您拥有两个表之间的链接。您可以通过添加以下内容来删除生成的合成键:
现在,表是使用
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:
Second, you load another table with the date
Next you will have to use the IntervalMatch. This is one way to do it:
Now you have the link between the two tables. You can delete the resulting synthetic key by adding this:
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 thecommonkey
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.
当然可以 - 我想你想要的是 IntervalMatch 函数。
Sure can - I think what you want it the IntervalMatch function.