I have this query and, for some reason, I am getting an error message when I write different functions related to dates (TO_DATE, DATEADD, DATESUB, and others):
t.dates AS dates
, COUNT(DISTINCT t.client_id) AS client_id
client_id AS client_id
date AS dates
) AS t
TO_DATE(t.dates) BETWEEN t.dates AND DATEADD(month, '3', t.dates)
GROUP BY 1
ORDER BY 1
Sadly I could not find any solution. What could it be?
Thanks in advance!