SQL查询以比较两个日期值

问题描述 投票:0回答:1

我想在查询的where条件下比较Impala / Hive中的2个字段。以下是每列中的一个样本值

  • column_1 = 202003
  • column_2 = '03 / 01/2020'

我想比较这两列。在上述情况下,“ where column_1 = column_2”应返回true,因为它们是同一年和同一月。

我如何编写where条件比较两列。非常感谢!!!

sql impala
1个回答
0
投票

我认为这可以满足您的要求:

column1 = concat(right(column_2, 4), left(column_2, 2))
© www.soinside.com 2019 - 2024. All rights reserved.