如何仅在 presto 中声明月份在 current_month 内
How to declare month to be within current_month only in presto
我在 WHERE 子句中有以下查询以仅过滤当月内的记录...
where date(date_id) >= date_trunc('month', current_date) and date(date_id) <= EOMONTH(date_trunc('month', current_date))
有谁知道如何将它设置为恰好 1 个月的范围(始终是当前月份)?
您可以使用 last_day_of_month()
available in Presto 331.
WHERE date(date_id) BETWEEN date_trunc('month', current_date)
AND last_day_of_month(current_date)
我在 WHERE 子句中有以下查询以仅过滤当月内的记录...
where date(date_id) >= date_trunc('month', current_date) and date(date_id) <= EOMONTH(date_trunc('month', current_date))
有谁知道如何将它设置为恰好 1 个月的范围(始终是当前月份)?
您可以使用 last_day_of_month()
available in Presto 331.
WHERE date(date_id) BETWEEN date_trunc('month', current_date)
AND last_day_of_month(current_date)