mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
34 lines
556 B
SQL
34 lines
556 B
SQL
SELECT argMaxOrNull(id, timestamp)
|
|
FROM
|
|
(
|
|
SELECT
|
|
CAST(NULL, 'Nullable(UInt32)') AS id,
|
|
2 AS timestamp
|
|
);
|
|
|
|
SELECT
|
|
argMax(id, timestamp),
|
|
argMaxOrNull(id, timestamp)
|
|
FROM
|
|
(
|
|
SELECT
|
|
CAST(NULL, 'Nullable(UInt32)') AS id,
|
|
2 AS timestamp
|
|
UNION ALL
|
|
SELECT
|
|
1 AS id,
|
|
1 AS timestamp
|
|
);
|
|
|
|
SELECT argMaxIfOrNull(id, timestamp, id IS NOT NULL)
|
|
FROM
|
|
(
|
|
SELECT
|
|
CAST(NULL, 'Nullable(UInt32)') AS id,
|
|
2 AS timestamp
|
|
UNION ALL
|
|
SELECT
|
|
1 AS id,
|
|
1 AS timestamp
|
|
);
|