clickhouse 查询3天前函数
ClickHouse数据库提供了几个函数可以查询三天前的数据,其中最常用的函数是today()和toDate()。
- 使用
today()函数:
SELECT * FROM table_name WHERE date_column >= today() - INTERVAL 3 DAY;
这将返回date_column大于等于三天前的所有数据。
- 使用
toDate()函数:
SELECT * FROM table_name WHERE toDate(date_column) = toDate(today() - INTERVAL 3 DAY);
这将返回date_column等于三天前的所有数据。请注意,toDate()函数会将日期时间戳转换为日期。
请根据你的具体需求选择合适的函数。
原文地址: https://www.cveoy.top/t/topic/hL7i 著作权归作者所有。请勿转载和采集!