I am using a MSSQL database and trying to do a datediff on a table.
my_tbl is a table reference
tbl(con, in_schema('foo', 'dbo.table'))
my_tbl %>% select(`DOCUMENT STATUS`, `PAYMENT AMOUNT`, `PAYMENT DATE`, `INVOICE DATE`) %>% mutate(invoice_age = DATEDIFF(`INVOICE DATE`, `PAYMENT DATE`)) %>% top_n(100)
This doesn't get translated to DATEDIFF().. I tried to use DATADIFF(day,
PAYMENT DATE) and that doesn't work either.
Any idea how to get this to translate to the correct sql statement?