Home > Software design >  Last Nth Day in click house
Last Nth Day in click house

Time:01-04

I use above condition in mysql to extract last 7 day date. how it works in clickhouse ?? I tried looking for it in click house docs but found nothing

   where date(created_at) = CURDATE() - INTERVAL 7 DAY

CodePudding user response:

As the documentation shows, Clickhouse supports interval syntax (similar to other databases such as MySQL and Postgres).

We can rewrite your MySQL WHERE clause in Clickhouse as follows:

WHERE toDate(created_at) = toDate(now()) - INTERVAL 7 DAY
  • Related