DATEDIFF examples please


#1

I’ve been doing many variants of this:
SELECT case_number, DATEDIFF(DAY,NOW(),date_open) from case_open;

Nothing is working.

Can anyone provide a few examples of proper ways to use DATEDIFF please.


#2

@davidrubert can you provide a few sample rows of data?


#3

Hi @davidrubert, DAY needs to be in single quotes, i.e. SELECT case_number, DATEDIFF('DAY',NOW(),date_open) from case_open;

I noticed that we don’t document the need for single quotes so will notify the doc team. Sorry for any inconvenience!

Regards


#4

thanks @darwin! i checked the docs and didn’t see anything amiss in the query. nice catch!


#5

Thank you Darwin and easy. That was the magic.