0

What would be the best solution for int_months_betweenin weeks for Impala? Would I have to work with Invervals or what is the best recommendation.

Anna
  • 444
  • 1
  • 5
  • 23

1 Answers1

0

The easiest way would be to use datediff function, which returns difference in days, and then to divide the result with 7. It will not be precise in terms of business weeks, and there might be some ambiguous results at the beginning or end of the year, but in general it should do the trick. This is function signature for Impala 5.8.x:

datediff(timestamp enddate, timestamp startdate)

Matko Soric
  • 107
  • 3
  • 16