myVertica  

Vertica Blog

Average Date: Quick Tip

Jim Knicely authored this tip.

Given a list of dates, how do I find the “average” date? Like this…

Example: dbadmin=> SELECT * FROM dates; mydate ------------ 2018-07-10 2018-07-12 (2 rows) dbadmin=> SELECT AVG(JULIAN_DAY(mydate)) + '4714-11-24 BC'::DATE avg_date dbadmin-> FROM dates; avg_date --------------------- 2018-07-11 00:00:00 (1 row) Have fun!