如何在 table 中减去今天的日期(或查找天数间隔)?

How can I substract today date (or find interval id days) in a table?

我正在使用 Vertica SQL 并具有以下 table:

CREATE temp TABLE XXX (DATE TEXT, PRICE INTEGER);
INSERT INTO XXX VALUES 
('2019-04-27 01:00', 1), ('2019-04-27 02:30', 3), ('2019-04-27 18:00',2), 
('2019-04-28 17:00', 2), ('2019-04-28 21:00', 5), 
('2019-04-29 17:00',50), ('2019-04-29 21:00',10), 
('2019-04-30 17:00',10), ('2019-04-30 21:00',20), 
('2019-05-01 17:00',40), ('2019-05-01 21:00',10), 
('2019-05-02 17:00',10), ('2019-05-02 21:00', 6);

我想找出今天和 table 中的日期之间的差异(以天计算)。 我尝试使用

select (date_trunc('month',DATE)-date_trunc('month',current_date)) as DATE, PRICE from XXX

据我了解,初始 table 有 13 行,但是 date_trunc('month',current_date) 有 1 行。结果我有一个错误。如何解决这个问题?

当我使用 Vertica 时,我应该在标签中添加 PostgreSQL 还是 MySQL?

尝试 datedifftimestampdiff

 datediff('day', date , Now()) as DaysBetweenDates

 timestampdiff(day, date, Now()) as DaysBetweenDates