Months_Between equivalent


In Oracle I’ve often used the function Months_between (, )

I get a number value returned.

Is there an equivalent method to get this in Dremio?

I’ve tried date_diff but it doesn’t return numbers and casting to number fails.

Any help would be appreciated.

@myaccount, welcome to the Dremio Community!

There is a MONTHS_BETWEEN() in Dremio :slight_smile:

SELECT MONTHS_BETWEEN (TO_DATE (‘2003/01/01’, ‘yyyy/mm/dd’), TO_DATE (‘2003/03/14’, ‘yyyy/mm/dd’) )

Thank you so much for the quick reply :slightly_smiling_face:

Is there a reason this isn’t in the documentation of functions?

I think I made a false assumption that if it’s not in the documentation it doesn’t work. Thanks again for clarifying…

@myaccount I think your assumption is right that it has to be documented, I have opened a ticket with our docs team to get it added

Thanks for getting this added.

@myaccount Here you go: Dremio