在U-SQL中比较日期范围的最佳方法? [英] Best way to compare date ranges in U-SQL?

查看:93
本文介绍了在U-SQL中比较日期范围的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道在重叠日期范围内加入2个表的最佳方法?

Does anyone know the best way to join 2 tables on overlapping date ranges?

我所拥有的是2个包含开始和结束日期列的表。我想加入日期范围重叠的表格。我尝试了一些查询,但速度很慢。

What I have is 2 tables with start and end date columns. I'd like to join the tables where the date ranges overlap. I've tried some queries but they are very slow.







推荐答案

取决于用例。

Depends on the use-case.

当需要进一步的日历演算时,那么经常使用日历表作为基表并加入其他表可以简化逻辑。但是对于较大集合的成本。

When it's required for further calendar calculus, then often using a calendar table as base table and join the other tables can simplify logic. But for the cost of larger sets.

但基本上它是对负面标准的非等式连接:非重叠。这只是

But basically it is a non-equi join over the negative critera: NOT non-overlapping. Which is simply

.. INNER JOIN .. ON NOT (B.ToDate < A.FromDate OR A.ToDate < B.FromDate)


这篇关于在U-SQL中比较日期范围的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆