Q: SQL - select date (created_at column) for interesting aggr func match I have a table:
id   client  price   created_at
1    0x67    99      2021-01-23
2    0x67    22      2021-01-23  
3    0x67    10      2021-01-25
4    0x67    88      2021-01-28

I need SQL query, that finds MIN and MAX values, with associated  created dat date.
So, I expect next result:
client   price_min  price_min_date  price_max     price_max_date
0x67     10         2021-01-25      99            2021-01-23

Clickhouse DB.
Thanks!

A: Just found solution:
https://clickhouse.com/docs/ru/sql-reference/aggregate-functions/reference/argmin/
select 
client, 
min(toFloat64(price)) as min_liquidity,
max(toFloat64(price)) as max_liquidity,
argMin(created_at, price) as min_liquidity_date,
argMax(created_at, price) as max_liquidity_date

from <...table...>

group by client

