Skip to main content

3 posts tagged with "SQL"

View All Tags

· One min read
Samzong Lu

需要取值整点时间

项目上需要取值上一个整点的数据查询处理,落表,然后实现按小时更新

ClickHouse

subtractHours(date_trunc('hour',now()),1)

MySQL

and auth_time >= DATE_SUB(DATE_FORMAT(now(),'%Y-%m-%d %H:00:00'),interval 1 hour)
and auth_time < DATE_FORMAT(now(),'%Y-%m-%d %H:00:00')