Skip to content Skip to sidebar Skip to footer

How To Select Data Basing On Both A Period Of Date And A Period Of Time In Clickhouse

I want to filter some data by both yyyymmdd(date) and hhmmss(time), but clickhouse don't support time type. So I choose datetime to combine them. But how to do such things: This is

Solution 1:

Assume that you just want to average the trading price in normal trading hours, excluding after hour trading, then a possible solution:

SELECTavg(ofr + bid) /2.0AS avg_price
FROM taq
WHERE
    toYYYYMMDD(time) BETWEEN20070805AND20070807AND
    toYYYYMMDDhhmmss(time)%1000000BETWEEN93000and160000GROUPBY symbol, toYYYYMMDD(time)

This filters the taq table within specified date and time.

Post a Comment for "How To Select Data Basing On Both A Period Of Date And A Period Of Time In Clickhouse"