In clickhouse table I have multiple rows for one _id
. What I want is to get only one row for each _id
where column _status_set_at
has its max value. That's what I am currently at:
SELECT _id, max(_status_set_at), count(_id)FROM pikta.candidates_statesGROUP BY _id
Because I can't use max()
function at WHERE
clause, how to workaround this problem?count(_id)
shows how many rows are there for each _id
, if the query is correct, it should show 1.Also, as far as I concerned, there is no ON
clause in Clickhouse database.
UPD: there is ON
clause in Clickhouse